I have txt file and use the following command to read it
to R:
z <- read.table("c:/temp/test.txt")
and I type z but the output is totally a mess; the test.txt is
strutured with the first line as the variable names and when use excel
to open it, all the vaules are well positioned. why in R it is totally
in a mess?
Linda
linda.s a ?crit :
> I have txt file and use the following command to read it
> to R:
> z <- read.table("c:/temp/test.txt")
> and I type z but the output is totally a mess; the test.txt is
> strutured with the first line as the variable names and when use excel
> to open it, all the vaules are well positioned.
why in R it is totally
> in a mess?
Because R needs some precision on the data file, example:
z <- read.table("c:/temp/test.txt",
header=TRUE,sep=",",na.strings="NA",
dec=",", strip.white=TRUE)
You can also take a look at ?read.table
E.
> Linda
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>
>
>
--
On 3/23/06, Cuvelier Etienne <ecu at info.fundp.ac.be> wrote:> linda.s a ?crit : > > I have txt file and use the following command to read it > > to R: > > z <- read.table("c:/temp/test.txt") > > and I type z but the output is totally a mess; the test.txt is > > strutured with the first line as the variable names and when use excel > > to open it, all the vaules are well positioned. > why in R it is totally > > in a mess? > Because R needs some precision on the data file, example: > > z <- read.table("c:/temp/test.txt", header=TRUE,sep=",",na.strings="NA", > dec=",", strip.white=TRUE) > > You can also take a look at ?read.table > > E. > > LindaThank you. There are many things for me to learn by tutorial. I will do it step by step. thanks! Linda