I have a relatively large csv files (1.2gb… large to the 2gb RAM on one of my computers). To every entry in one column I would like to append “1C” so that I can join/merge with another dataframe/db table.
If the file weren’t so large, it would be easy to use read.csv to import to data then use data$symbol <- paste(data$symbol, "1C", sep=""). But now I get the can't allocate vector of size x warning.
Is a manual solution, like scan(), my only option? (I’m a bit afraid of corrupting my data) Thanks!
Using
scanisn’t going to help if you can already get your data into R.Make sure
dataonly has the columns you need to merge, and rungc()before you try yourpastecommand (gcwill help if you’re near the margin of your memory limit).If that fails, look at some of the solutions in this thread.
UPDATE:
And if you happen to be using a flavor of *nix, or if you have Rtools installed on windows, you could do this with
gawk. If your data are infoo.csvand you want to add the “C1” to the second column, this will create a new file,bar.csv, with “C1” appended to the second column.This will likely be faster than R and will consume a negligible amount of memory.