[R] mysql retrive question

simone gabbriellini ogabbrie at tin.it
Mon Apr 4 16:32:36 CEST 2005


hello R-Users,
I have this simple but not for me question:

I do:

 > res<-dbSendQuery(con, "SELECT * FROM tabellaProva")
 > myDataFrame<-fetch(res)
 > myDataMatrix<-as.matrix(myDataFrame[,-1])
 > namerows(myDataMatrix)<-as.character(myDataFrame[,1])

and I have:

       io  tu
io  "0" "1"
tu  "1" "0"

my problem is that the content of the matrix is interpreted by R as 
strings, not as numbers.
Is there a way to convert those characters to numbers like

     io  tu
io  0 1
tu  1 0

thanx in advance,
simone




More information about the R-help mailing list