[R] how to read a freetext line ?

Sarah Goslee sarah.goslee at gmail.com
Thu Nov 17 15:47:34 CET 2011


On Thu, Nov 17, 2011 at 9:37 AM, Jie TANG <totangjie at gmail.com> wrote:
> hi everyone .
>  Here I have a text where there are some integer and string variables.But I
> can not read them by readLines and scan

I've seen this question several times this morning. If that's you,
please do not post multiple times. If you haven't gotten an answer in
a couple days, then it's okay to ask again, but the trouble is usually
with your question, like here.

> the text is :
> weight ;30;130
> food:2;1;12
> color:white;black
> the first column is the names of the variables and others are the value of
> them.
>  the column in different line are different.
> Can anyone help me ?

What have you tried?
What format do you need? For instance, reading them in as a single
string is easy. Using strsplit() to separate that single string into
several strings is easy. But without knowing what you are trying to
achieve, there's really no way to help you beyond suggesting those two

Sarah Goslee

More information about the R-help mailing list