[R] how to reach a txt file like this?

John McKown john.archie.mckown at gmail.com
Tue Jun 9 19:15:46 CEST 2015


On Tue, Jun 9, 2015 at 11:24 AM, Ye Lin <yelin at lbl.gov> wrote:

> ​Hey All, I have a txt data file that looks like this:
>
> ​[{“ID”:“A”,“Name":"Tom", "Age":"18"},{“ID”:“B”,“Name":"Jim", "Age":"19"}]
>
>
> ​How can I read this into R as a data frame? I have used readLines to read
> all the lines but dont know how to deal with column names and inputs.
>

​That looks like a JSON array of objects to me. I would look into
"jsonlite", "rjson", or "RJSONIO" on CRAN. You'll need to review them to
see which best meets your needs.​


>
> Thanks for your help!​
>
>         [[alternative HTML version deleted]]
>

​ Please change to plain text. In many cases HTML displays poorly due to
the list trying to change it for you to plain text. And, in that case,
you'll likely be ignored.
​

-- 
Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

My sister opened a computer store in Hawaii. She sells C shells down by the
seashore.
If someone tell you that nothing is impossible:
Ask him to dribble a football.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

	[[alternative HTML version deleted]]



More information about the R-help mailing list