Dear sir, If I have a vector as: >y <- c(1:4) and a matrix as: >x <- matrix (5:12, nrow=4, ncol=2)
Then I create a data frame as: >t <- data.frame(y, x) R will generate a data frame of 3 columns >names(t) > "y" "X1" "X2" >is.vector(t$X1) returns TRUE > is.vector(t$X2) returns TRUE R splits the columns of a matrix into column vectors automatically. How should I create a data frame of t$y & t$x such that >is.vector(t$y) returns TRUE >is.matrix(t$x) returns TRUE That is, how to make x column of the data frame a matrix? Just like the test data ¡§gasoline¡¨ in your PLS package: >library(pls) >data(yarn) >is.vector(density) returns TRUE >is.matrix(NIR) returns TURE (NIR is a matrix) Best regards, Shaowen Cheng ________________________________ The information in this e-mail may be confidential; it is intended for use solely by the individual or entity named as the recipient hereof. Disclosure, copying, distribution, or use of the contents of this e-mail by persons other than the intended recipient may violate applicable laws and if you have received this e-mail in error, please delete the original message and notify us by collect call immediately. Thank you. [[alternative HTML version deleted]]
______________________________________________ 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.