0

My computer can't handle the importation of a particularly large text file (I get error - cannot allocate vector of size...).

I'm using the following code :

data<-read.table("file.txt",header = TRUE,sep = ";",
                      dec = ",", quote = "", strip.white = TRUE,)

As I only need to use the data corresponding to females within the file, is there any way to directly import just the females (data$sex==2).

...I'm using windows 8, the file has 88 variables (integers, factors and characters) of which I'm interested in abut 5 of them.

user2568648
  • 3,001
  • 8
  • 35
  • 52
  • What OS are you using? What is the structure of your files. Show a few lines (you can read in a few with `nrows = 5` argument to `read.table`). – Simon O'Hanlon Nov 15 '13 at 15:02
  • 2
    If the data will fit in your ram, you might be able to read it by supplying the `n` and `colClasses` arguments. See here: http://stackoverflow.com/questions/14294217/reading-large-files-into-r/14294242#14294242 – Matthew Lundberg Nov 15 '13 at 15:07
  • 1
    Maybe use `scan` in a loop with the `skip` argument, and delete the unwanted portions before reading in the next chunk. – Carl Witthoft Nov 15 '13 at 15:22
  • Thanks, the skip method allows me to import my data, even if it is a convoluted process. – user2568648 Nov 16 '13 at 15:03

0 Answers0