-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
project.org] On Behalf Of Ken
Sent: Wednesday, August 03, 2011 12:13 PM
To: Jeffrey Joh
Cc: <r-help at r-project.org>
Subject: Re: [R] Convert matrix to numeric
How about
Matrix[1:5,]=as.numeric(Matrix[1:5,])
-Ken Hutchison
On Aug 3, 2554 BE, at 3:04 PM, Jeffrey Joh <johjeffrey at hotmail.com>
wrote:
I have a matrix that looks like this:
structure(c("0.0376673981759913", "0.111066500741386", "1", "1103",
"18", "OPEN", "DEPR", "0.0404073656092023", "0.115186044704599",
"1", "719", "18", "OPEN", "DEPR", "0.0665342096693433",
"1", "1103", "18", "OPEN", "DEPR", "0.119287147905722",
"1", "1103", "18", "OPEN", "DEPR"), .Dim = c(7L, 4L), .Dimnames =
c("Sn", "SlnC", "housenum", "date", "hour", "flue",
), c("10019.BLO", "1002.BLO", "10020.BLO", "10021.BLO")))
How do I convert rows 1-5 to numeric? I tried mode() <- "numeric"
but that doesn't change anything.