[R] Reading and writing data

Dermot MacSweeney dsweeney at nmrc.ucc.ie
Tue Apr 24 10:54:47 CEST 2001


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))
write.table(test,file="output")

"rnorm.2."
"1" -0.718560808193286
"2" -1.07965693020656

Is it possible to output the data without the first column, i.e.,

"rnorm.2."
-0.718560808193286
-1.07965693020656

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.

Thanks in advance,
Dermot.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 mailing list