Data.frame converted to characters when making it into a matrix. Why? – General
Hi
When I convert my data.frame into a matrix, everything is changed into characters. Why? And how do I stop that from happening?
data.frame(
value = c(2L,3L,2L,4L,2L,1L,3L,2L,1L,2L,4L,
5L,3L,4L,4L,4L,3L,3L,3L,3L,3L,3L,4L,4L,3L,3L,4L,
3L,4L,3L,3L,2L,3L,4L,2L,2L,2L,1L,2L,2L),
time = as.factor(c(“before”,”before”,
“before”,”before”,”before”,”before”,”before”,
“before”,”before”,”before”,”1dayafter”,”1dayafter”,
“1dayafter”,”1dayafter”,”1dayafter”,”1dayafter”,
“1dayafter”,”1dayafter”,”1dayafter”,”1dayafter”,
“1weekafter”,”1weekafter”,”1weekafter”,”1weekafter”,
“1weekafter”,”1weekafter”,”1weekafter”,”1weekafter”,
“1weekafter”,”1weekafter”,”1monthafter”,
“1monthafter”,”1monthafter”,”1monthafter”,”1monthafter”,
“1monthafter”,”1monthafter”,”1monthafter”,
“1monthafter”,”1monthafter”)),
student = as.factor(c(“A”,”B”,”C”,”D”,”E”,
“F”,”G”,”H”,”I”,”J”,”A”,”B”,”C”,”D”,”E”,
“F”,”G”,”H”,”I”,”J”,”A”,”B”,”C”,”D”,”E”,”F”,
“G”,”H”,”I”,”J”,”A”,”B”,”C”,”D”,”E”,”F”,
“G”,”H”,”I”,”J”))
)
Thanks.
Read more here: Source link