How to get the disk space of a Windows machine with R?

How can I get the total disk space / free space on my windows computer?

If there is no R function, perhaps there is a windows command that I could use in the R system function, but I could not find this command.

+5
source share
1 answer

Although it’s really hard for me to believe that the Google search for windows cmd disk space turned out to be empty for you, this should provide the necessary information without the need for administrator privileges:

 disks <- system("wmic logicaldisk get size,freespace,caption", inter=TRUE) disks <- read.fwf(textConnection(disks[1:(length(disks)-1)]), widths=c(9, 13, 13), strip.white=TRUE, stringsAsFactors=FALSE) colnames(disks) <- disks[1,] disks <- disks[-1,] rownames(disks) <- NULL disks ## Caption FreeSpace Size ## 1 A: ## 2 C: 52617023488 63898120192 ## 3 D: 

Just thought I'd add that this answer comes from a person who is mainly an OS X / Linux user.

+6
source

All Articles