[R] Why do the results of paste() depend on how the argument (data.frame) is constructed?
thmsfuller066 at gmail.com
thmsfuller066 at gmail.com
Mon Aug 2 03:48:39 CEST 2010
Hi,
The following two 'df's should be the same, although their
constructions are different. But the results of paste() are different.
I don't see this is explained in ?paste. Could you help me understand
why it is like this?
> df=data.frame(X=c(1, 2, 3), Y=c(4, 5, 6))
> df
X Y
1 1 4
2 2 5
3 3 6
> paste(df)
[1] "c(1, 2, 3)" "c(4, 5, 6)"
> df=data.frame(X=1:3, Y=4:6)
> df
X Y
1 1 4
2 2 5
3 3 6
> paste(df)
[1] "1:3" "4:6"
>
--
Tom
More information about the R-help
mailing list