I have the following object which I want to extract the numbers without attributes to a data frame as a column. I tried this, but didn't work:
data.frame(do.call(rbind, alpha.bar))
Named num [1:66] 0.122 0.125 0.131 0.137 0.138 ...
- attr(*, "names")= chr [1:66] "alpha[1]" "alpha[2]" "alpha[3]" "alpha[4]" ...
From ?c:
c is sometimes used for its side effect of removing attributes except names, for example to turn an array into a vector. as.vector is a more intuitive way to do this, but also drops names. Note too that methods other than the default are not required to do this (and they will almost certainly preserve a class attribute).
It looks like you want to use,
data.frame(as.vector(alpha.bar))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With