[R] Reading word by word in a dataset
Uwe Ligges
ligges at statistik.uni-dortmund.de
Mon Nov 1 20:12:07 CET 2004
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
>>
>>______________________________________________
>>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
>>
>>
>
>
> ______________________________________________
> 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