Dear R-users,
I am somewhat puzzled by how R treats data frames with nested data frames.
Below are a couple of examples, maybe someone could help explain what the
guiding logic here is.
## construct plain data frame
> z <- data.frame(x=1)
## add a data frame member
> z$y <- data.frame(a=1,b=2)
## puzzle 1: z is apparently different from a straightforward construction of
the 'same' object
> all.equal(z, data.frame(x=1,y=data.frame(a=1,b=2)))
[1] "Names: 1 string mismatch"
"Length mismatch: comparison on first 2 components"
[3] "Component 2: Modes: list, numeric"
"Component 2: names for target but not for current"
[5] "Component 2: Attributes: < Modes: list, NULL >"
"Component 2: Attributes: < names for target but not for current >"
[7] "Component 2: Attributes: < Length mismatch: comparison on first 0
components >" "Component 2: Length mismatch: comparison on first 1 components"
## puzzle 2: could not rbind z
> rbind.data.frame(z, z)
Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "1")) :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique value when setting 'row.names': '1'
> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 9.1
year 2009
month 06
day 26
svn rev 48839
language R
version.string R version 2.9.1 (2009-06-26)
Thanks,
Vadim
Note: This email is for the confidential use of the named addressee(s) only and
may contain proprietary, confidential or privileged information. If you are not
the intended recipient, you are hereby notified that any review, dissemination
or copying of this email is strictly prohibited, and to please notify the
sender immediately and destroy this email and any attachments. Email
transmission cannot be guaranteed to be secure or error-free. Jump Trading,
therefore, does not make any guarantees as to the completeness or accuracy of
this email or any attachments. This email is for informational purposes only
and does not constitute a recommendation, offer, request or solicitation of any
kind to buy, sell, subscribe, redeem or perform any type of transaction of a
financial product.
______________________________________________
[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.