Was ist der Unterschied zwischen as.data.frame (x) und data.frame (x)Unterschied zwischen as.data.frame (x) und data.frame (x)
In diesem folgende Beispiel wird die Das Ergebnis ist das gleiche bei der Ausnahme der Spaltennamen.
x <- matrix(data=rep(1,9),nrow=3,ncol=3)
> x
[,1] [,2] [,3]
[1,] 1 1 1
[2,] 1 1 1
[3,] 1 1 1
> data.frame(x)
X1 X2 X3
1 1 1 1
2 1 1 1
3 1 1 1
> as.data.frame(x)
V1 V2 V3
1 1 1 1
2 1 1 1
3 1 1 1
Siehe Handbücher: [as.data.frame] (http://stat.ethz.ch/R-manual/R-devel /library/base/html/as.data.frame.html) vs [data.frame] (http://stat.ethz.ch/R-manual/R-devel/library/base/html/data.frame. html) – zx8754
Um die Dinge noch weiter zu verwechseln, versuchen Sie 'as (x," data.frame ")'. –