Skip to content

Remove a column of a matrix with unnamed column header

4 messages · Kuma Raj, Berend Hasselman, arun

#
On 08-11-2013, at 10:40, Kuma Raj <pollaroid at gmail.com> wrote:

            
rownames(test) <- NULL

Berend
#
Hi,
Try:
?test2 <- as.data.frame(test,stringsAsFactors=FALSE)
test2[,c(2:4)] <- lapply(test2[,c(2:4)],as.numeric)
A.K.
On Friday, November 8, 2013 6:24 AM, Kuma Raj <pollaroid at gmail.com> wrote:
Beend, Thanks for that. Conversion of test to a data frame resulted in a
factor. Is there a possibility to selectively convert to numeric??  I have
tried this code and that has not produced the intended result.
test[, c(2:4)] <- sapply(test[, c(2:4)], as.numeric)
On 8 November 2013 11:31, Berend Hasselman <bhh at xs4all.nl> wrote:

            
??? [[alternative HTML version deleted]]


______________________________________________
R-help at 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.