How to check the amount of RAM in R

穿精又带淫゛_ 提交于 2019-11-29 02:49:31

Given the warnings concerning platform-dependency discussed in the earlier comment, you could for example parse /proc/meminfo on Linux:

$ grep MemFree /proc/meminfo 
MemFree:          573660 kB
$ awk '/MemFree/ {print $2}' /proc/meminfo 
565464

You could try the second approach via system(..., intern=TRUE), or even via a pipe connection.

Edit some 5+ years later: In R, and just following what the previous paragraph hinted at:

R> memfree <- as.numeric(system("awk '/MemFree/ {print $2}' /proc/meminfo", 
+                               intern=TRUE))
R> memfree
[1] 3342480
R> 

Now you can do that with benchmarkme::get_ram function.

https://cran.r-project.org/web/packages/benchmarkme/benchmarkme.pdf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!