Have you looked at plyr?
Generally, ldply works well for this sort of thing.
--
View this message in context:
http://r.789695.n4.nabble.com/convert-a-list-to-a-data-frame-tp4532206p4533257.html
Sent from the R help mailing list archive at Nabble.com.
On Apr 4, 2012, at 4:54 PM, Sam Steingold wrote:
* Sam Steingold [2012-04-04 14:58:15 -0400]:
1. the strings I replaced with and are very long; I wish I
could replace them in the object all, not just in text
i.e., I have a long list with elements with long names.
how do I replace
> * Sam Steingold [2012-04-04 14:58:15 -0400]:
>
> 1. the strings I replaced with and are very long; I wish I
> could replace them in the object all, not just in text
i.e., I have a long list with elements with long names.
how do I replace all these long names with something shorter?
ro
Thanks for your reply!
1. the strings I replaced with and are very long; I wish I
could replace them in the object all, not just in text
2. `all` is the result of
as.data.frame(do.call("rbind",l),stringsAsFactors = FALSE)
3. I get my data frame as
fr <- data.frame(audience =
??? What is a?
?str
str(a)
?do.call
On Wed, Apr 4, 2012 at 9:34 AM, Sam Steingold wrote:
> sorry, google does give a good start.
>
>> Google on "R convert list to data frame".
>
> as.data.frame(do.call("rbind",a))
>
> returns an object which I don't understand.
>> summary(f)
> name.Length
sorry, google does give a good start.
> Google on "R convert list to data frame".
as.data.frame(do.call("rbind",a))
returns an object which I don't understand.
> summary(f)
name.Length name.Class name.Modestatus
1 -none- characterLength:4445
1
Please first search yourself before posting.
Google on "R convert list to data frame".
-- Bert
On Wed, Apr 4, 2012 at 8:11 AM, Sam Steingold wrote:
> I have a huge list (returned by fromJSON) with elements like this:
>
> $`zz/3260`
> $`zz/3260`$name
> [1] "myname"
>
> $`zz/3260`$status
> [1] "a
I have a huge list (returned by fromJSON) with elements like this:
$`zz/3260`
$`zz/3260`$name
[1] "myname"
$`zz/3260`$status
[1] "active"
$`zz/3260`$vectors
$`zz/3260`$vectors$`vector/241`
$`zz/3260`$vectors$`vector/241`$channel
[1] "channel/300"
$`zz/3260`$vectors$`vector/241`$targets
$`zz/326
8 matches
Mail list logo