[R] Reading and writing data
ligges at statistik.uni-dortmund.de
Tue Apr 24 11:45:41 CEST 2001
Dermot MacSweeney wrote:
> Hi All,
> Two quick questions.
> 1) I am using write.table to output data.frames to ascii files, e.g.,
> test <- data.frame(rnorm(2))
> "1" -0.718560808193286
> "2" -1.07965693020656
> Is it possible to output the data without the first column, i.e.,
It's in the help (?write.table):
row.names either a logical value indicating whether the row names of
x are to be written along with x, or a character vector of row names to
> 2) Is there a simple way to read in data and skip lines, i.e., say skip every
> second line. I could use ``scan'' to read in the data and use a "for" loop to
> perform the skipping in R. However, I am wondering is there a one-step method.
I don't know a one step method.
If the file is not too big, I would try reading in the whole data at
first and through away not needed lines after that.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help