Skip to content
Prev 227810 / 398500 Next

I need help making a data.fame comprised of selected columns of an original data frame.

Hi,

First: it's kind of hard to play along w/o some reproducible data. To
that end, you can paste into an email the output of:

dput(moreinfo)

If there are lots of rows in `moreinfo`, just give us the first ~10-20

dput(head(moreinfo, 20))

Anyway:

<snip>
Forget the for loop. How about:

ndf <- m_id_default[, c('mid, 'estimate', 'sd', 'loglik', 'aic',
'bic', 'chisq', 'chisqpvalue', 'chisqdf')

Having just written that, I see something strange in your for loop.
Specifically this line:
m_id_default_res is a data.frame, right? Why don't you try to see what
`m_id_default_res[1]` returns.

I'm not sure that that's what your error message is coming from, but I
foresee this to be a problem anyway, if I follow your "build up" code
correctly.

Hope that helps,