converting numeric to ordered
Hello all, would someone please tell me why the following code doesn't "work" (i.e. do what i expected!). I wanted to convert numeric variables in a matrix to ordered (for input as nominal variables into the 'daisy' program). Why does the following code seem to work, but the "is.ordered" command reports that the variables are not ordered (factors)??
xxx <- matrix(c(0,1,0,1,0,1,0,1,0),ncol=3) xxx
[,1] [,2] [,3] [1,] 0 1 0 [2,] 1 0 1 [3,] 0 1 0
yyy <- apply(xxx,2,as.ordered) yyy
[,1] [,2] [,3] [1,] 1 2 1 [2,] 2 1 2 [3,] 1 2 1
apply(yyy,2,is.ordered)
[1] FALSE FALSE FALSE Duncan ******************************************* Dr. Duncan Mackay Biology Flinders University GPO Box 2100 Adelaide S.A. 5001 AUSTRALIA Ph (08) 8201 2627 FAX (08) 8201 3015 http://www.bio.flinders.edu.au/dam/damres.htm -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._