Reputation: 1771
the question is quite simple but I haven't find any answers on google or in the ?options
function of R.
I actually updated my R and RStudio version and since then, each time I use a function such as memory.limit()
, the output is given to me as bytes instead of megabytes or gigabytes. This is not a real problem but I find more convenient to read 32 000MB instead of 32000000000 bytes.
I know this is probably in some options but even looking at ?memory.limit
it seems there's no units or format as arguments.
As far as coding goes I want (MB) :
memory.limit()
32000
instead of (bytes) :
memory.limit()
32000000000
Please note that I don't want a function converting bytes to megabytes, I simply want to change the print behavior of R in this regard.
Thank you.
Upvotes: 0
Views: 421
Reputation: 5529
Try using format()
.
format(memory.limit(), units = "Mb")
Also good to know:
format(thing_to_format, units = 'auto')
Upvotes: 1