Hi Everyone, I am having trouble turning my data.frame into a matrix format. Because I wanted to change my data.frame with mostly factor variables into a numeric matrix, I used the following code --> UN2010frame<-data.matrix(lapply(UN2010,as.numeric))
However when i checked the mode of the UN2010frame, it still showed up as a list. Because the code I want to run (Ordrating) does not accept data in a list format, I used UN2010matrix <- unlist(UN2010frame) to unlist my matrix. When I did this, my first row ( which was formerly a row with column names) turned into NAs. This was a problem for me because when I tried to run an ordinal IRT model using this data set, I got the following error message. Error in 1:nrow(Y) : argument of length 0 I think it is because all the values in my first row are now gone.... If you could help me on any front, It would be deeply appreciated. Thank you very much! Haillie -- View this message in context: http://r.789695.n4.nabble.com/Unlist-command-drops-all-my-column-names-in-the-first-row-and-adopts-NAs-tp3463294p3463294.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org 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.