[R] new to R

Francisco J. Zagmutt gerifalte28 at hotmail.com
Thu Mar 23 23:03:51 CET 2006


Hi Linda

Did you already get a reply to your question?  If not, try adding a new line 
at the end of the text (just hit enter after 69,the last number in your data 
and save the file).  You also want to use the argument "sep" in read.table

Since you have a comma at the end of each row you can either manually delete 
that and use read.table, or just import it the way it is and then delete the 
last variable ("V4") created because of the extra comma i.e

z<- read.table("q.txt", sep=",")
z
  V1 V2 V3 V4
1  1  2  3 NA
2 33 44 88 NA
3 23 43 69 NA

#V4 is an artifact from your extra comma at the end of each row

newz<-z[,-4] #Deletes V4

I hope this helps

Francisco

>From: "linda.s" <samrobertsmith at gmail.com>
>To: R-help at stat.math.ethz.ch
>Subject: [R] new to R
>Date: Thu, 23 Mar 2006 01:05:21 -0800
>
> > z <- read.table("c:/temp/q.txt")
>Warning message:
>incomplete final line found by readTableHeader on 'c:/temp/q.txt'
>what does that mean?
>my q.txt is like:
>1, 2, 3,
>33, 44, 88,
>23, 43, 69,
>
>______________________________________________
>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




More information about the R-help mailing list