[R] Reading word by word in a dataset

Liaw, Andy andy_liaw at merck.com
Mon Nov 1 19:44:12 CET 2004


Using R-2.0.0 on WinXPPro, cut-and-pasting the data you have:

> read.table("clipboard", colClasses=c("character", "NULL", "NULL"))
             V1
1      i1-apple
2     i2-banana
3 i3-strawberry

HTH,
Andy

> From: j lee
> 
> Hello All,
> 
> I'd like to read first words in lines into a new file.
> If I have a data file the following, how can I get the
> first words: apple, banana, strawberry?
> 
> i1-apple        10$   New_York
> i2-banana       5$    London
> i3-strawberry   7$    Japan
> 
> Is there any similar question already posted to the
> list? I am a bit new to R, having a few months of
> experience now.
> 
> Cheers,
> 
> John
> 
> ______________________________________________
> 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