Hi Jason,

data[] is a data frame, remember--you need to specify rows AND columns. So,
data[,c(2,12,17)] is what you should be doing in the first place, and
data[,842:2411] in the second place.

Not sure if the help you needed was using the comma, or the : syntax, or if
you're trying to read only certain columns during the read.csv process
(which I don't think that's possible).

--Adam

On Sun, 14 Sep 2008, Jason Thibodeau wrote:

Hello,

I realize that using: x[x > 3 & x < 5] I can fetch all elements between 3
and 5. However I read in from a CSV file, and I would like to fetch all
columns from within a range ( 842-2411). In teh past, I have done this to
fetch just select few columns:

data <- read.csv(filein, header=TRUE, nrows=320, skip=nskip)
                       data_filter <- data[c(2,12,17)]
                       write.table(data_filter, fileout, append = TRUE,
sep= ",", row.names= FALSE, col.names = FALSE)
                       nskip <- nskip+320

This time, however, instead of grabbing columns 2, 12, 17, I woudl like all
columns in the range of 842-2411. I can't seem to do this correctly. Could
somebody please provide some insight? Thanks in advance.

--
Jason Thibodeau

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to