Upon reading the plyr documentation that was the distinct impression I got and
I´m glad that whatever expectations I had developed regarding plyr were
fulfilled. Thx for the input Hadley.
Maybe this is a cumbersome solution, but it works..
And Matthew, I will most definitively look into
correction...
Col and rows were mixed up and loop only worked when rows were less than or
equal to number of columns
//M
test-function(a){
coef(summary(a))-lo
a-colnames(lo)
b-rownames(lo)
c-length(a)
e-character(0)
r-NULL
for (x in (1:length(b))){
On Aug 9, 2010, at 7:51 AM, moleps wrote:
Dear all,
I´m having trouble getting a list of regression variables back into
a dataframe.
mydf - data.frame(x1=rnorm(100), x2=rnorm(100), x3=rnorm(100))
mydf$fac-factor(sample((0:2),replace=T,100))
mydf$y-
If you look at the output (as I did) you should see that despite
whatever expectations you have developed regarding plyr, that it did
not produce a grouping variable:
ldply(dl, function(x) coef(summary(x)) )
facEstimate Std. Error t value Pr(|t|)
10 -0.3563418
On Mon, Aug 9, 2010 at 9:29 AM, David Winsemius dwinsem...@comcast.net wrote:
If you look at the output (as I did) you should see that despite whatever
expectations you have developed regarding plyr, that it did not produce a
grouping variable:
ldply(dl, function(x) coef(summary(x)) )
fac
On Aug 9, 2010, at 10:11 AM, moleps wrote:
ldply doesnt need a grouping variable as far as I understand the
command..
There is one further improvement to consider. When I tried using dlply
to tackle a problem on which I had been bashing my head for the last
three days and it gave just
There is one further improvement to consider. When I tried using dlply to
tackle a problem on which I had been bashing my head for the last three days
and it gave just the results I had been looking for, I also noticed that the
dlply function returns the grouping variable levels in an
ldply doesnt need a grouping variable as far as I understand the command..
Description
For each element of a list, apply function then combine results into a data
frame
Usage
ldply(.data, .fun = NULL, ..., .progress = none)
regards,
M
On 9. aug. 2010, at 15.33, David Winsemius wrote:
On Aug 9, 2010, at 12:47 PM, Hadley Wickham wrote:
There is one further improvement to consider. When I tried using
dlply to
tackle a problem on which I had been bashing my head for the last
three days
and it gave just the results I had been looking for, I also noticed
that the
dlply
That's exactly what dlply does - so you should never have to do that
yourself.
I'm unclear what you are saying. Are you saying that the plyr function
_should_ have examined the objects in that list and determined that there
were 4 rows and properly labeled the rows to indicate which list
Another option for consideration :
library(data.table)
mydt = as.data.table(mydf)
mydt[,as.list(coef(lm(y~x1+x2+x3))),by=fac]
fac X.Intercept. x1 x2x3
[1,] 0 -0.16247059 1.130220 2.988769 -19.14719
[2,] 1 0.08224509 1.216673 2.847960 -19.16105
[3,] 2
On Mon, Aug 9, 2010 at 4:30 PM, Matthew Dowle mdo...@mdowle.plus.com wrote:
Another option for consideration :
library(data.table)
mydt = as.data.table(mydf)
mydt[,as.list(coef(lm(y~x1+x2+x3))),by=fac]
fac X.Intercept. x1 x2 x3
[1,] 0 -0.16247059 1.130220
12 matches
Mail list logo