Hi All,
I need to place lists or vectors within dataframes as single
elements. However when I try this:
df=data.frame(y=1, x=I(list(c("a","b"), c("f","c"), c("a"))))
df
df[1,'x']=I(c("a","d"))
I get this error, even though I am using I():
Error in `[<-.data.frame`(`*tmp*`, 1, "x", value = c("a", "d")) :
replacement has 2 rows, data has 1
Note that this behavior does not match that described here <http://
finzi.psych.upenn.edu/R/Rhelp02a/archive/37297.html> in this post
from 2004.
Can someone please point me towards the right way to do this?
Thanks!!
Dan
$platform
[1] "i386-apple-darwin8.10.1"
$arch
[1] "i386"
$os
[1] "darwin8.10.1"
$system
[1] "i386, darwin8.10.1"
$status
[1] ""
$major
[1] "2"
$minor
[1] "6.2"
$year
[1] "2008"
$month
[1] "02"
$day
[1] "08"
$`svn rev`
[1] "44383"
$language
[1] "R"
$version.string
[1] "R version 2.6.2 (2008-02-08)"
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.