I am looping over csv files and putting the data into a "main" dataframe
I am on windows and using 32 bit R.
for(i in 1:length(files))
{
print(files[i])
f <- read.csv(files[i],header=TRUE, stringsAsFactors=FALSE)
if(i ==1)
{
main= f
}else
{
main = rbind(main, f)
}
print(dim(main))
print(memory.size(max = FALSE))
}
I am getting this error:
Error: cannot allocate vector of size 64.0 Mb
The last print out of the dim of main and the size is
[1] 4335123 49
[1] 2139.9
so there are 4.3 million rows in main and I think the size means 2139 mb are being used in R.
Any idea how I can get around this error? Main needs to hold about 7 million rows.
Thank you.