Hi, With the following codes, I attempt to convert the data.frame into a matrix.
However I notice that data.matrix function doesn't seem to work. __ BEGIN__ dat <- read.table("mydata", comment.char = "!" , na.strings = "null"); # Select n-genes by random sample # n = 1 nosamp <- 1 geneid <- sequence(nrow(dat)) geneid.samp <- sample(geneid,nosamp) geneid.samp gexp<- dat[geneid.samp,] gexp.arr <- data.matrix(gexp, rownames.force = NA) print(is.matrix(gexp.arr)) print(gexp.arr) __END__ Yielding this output: __BEGIN__ > print(is.matrix(gexp.arr)) [1] TRUE > print(gexp.arr) V1 V2 V3 V4 V5 V6 V7 V8 10354 803.1 1107.8 431.6 349.8 386.7 646.3 744.2 620.9 __END__ I expect "gexp.arr" to be a plain vector (numeric). What's wrong with my code above? -- Gundala Viswanath Jakarta-Indonesia ______________________________________________ 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.