[R] (no subject)

Steve Lianoglou mailinglist.honeypot at gmail.com
Thu Jul 2 16:21:51 CEST 2009


Hi,
> I am trying to load an csv-file in R, but it works wrong!
>
> My data is
>
>
> 0,0127
>
> -0,0016
>
> 0,0113
>
> 0,0037
>
> -0,0025
>
>
>> Ret<-read.csv("Ret.csv")
>> Ret
>  X0 X0127
> 1  0    16
> 2  0   113
> 3  0    37
> 4  0    25


This looks correct to me. The read.csv function assumes the first line  
in the file is a header, and it also uses the "," character a the  
separator between columns. Try:

ret <- read.csvl('Ret.csv', header=FALSE)

Still you'll have two columns, but I'm guessing the "," in your data  
is the decimal separator, in which case you should use read.csv2 (its  
"dec" argument defaults to ",").

alternatively, since your file just looks like one column, you can use  
the readLine() function and it will get you what you want, too.

-steve

--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University

Contact Info: http://cbio.mskcc.org/~lianos/contact




More information about the R-help mailing list