I am trying to put data in a data framework:
> mymatrix <- matrix(seq(1, 12), ncol=4)
> mymatrix
[,1] [,2] [,3] [,4]
[1,] 1 4 7 10
[2,] 2 5 8 11
[3,] 3 6 9 12
> myresults <- c(TRUE, FALSE, TRUE)
I would like to encapsulate this in a data frame:
> df <- data.frame(mymatrix, myresults)
> df
X1 X2 X3 X4 myresults
1 1 4 7 10 TRUE
2 2 5 8 11 FALSE
3 3 6 9 12 TRUE
However, when I try to find:
> df$mymatrix
NULL
> df$
df$X1 df$X2 df$X3 df$X4 df$myresults
- Why df $ mymatrix
NULL? - Why did mymatrix columns leak into the namespace
df$?
Note. I am trying to create data similar to a package of yarn
source
share