Liaw, Andy wrote:

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


... and if only the words after "-" are of interest, the statement can be followed by

 sapply(strsplit(...., "-"), "[", 2)


Uwe Ligges



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

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html





______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to