[R] using R how to read a one column alone from a database table from MySQL

Dieter Menne dieter.menne at menne-biomed.de
Thu Jan 15 17:55:48 CET 2009


sankar82 <sankar.arughadhoss <at> tkk.fi> writes:

> i have a created a database table in MYSQL consisting of 11 columns.
> throught RMYSQL i managed to read the entire table in R. but i have few
> qureries which i need solutions...here they are:
> 
> 1. Using R how to read a one column alone from a database table from MYSQL.
> 2. Using R how to print on screen those column value.
> 3. Using R how to print one particular row (in this case row is X)value
> alone.
> 4. Using R how to read all the column (11) and print (X) value alone on
> screen.
> 5. Using R with logic print those (X) value which is/between say 20 to 30
> degrees.
> 

Have you tried the examples in Rmysql-package?
For 5., you could use something like:

dbSendQuery(con, "select * from WL where width\_nm between 0.5 and 1")

Ok, here we let SQL do the job, and you homework want it to be done in R.

Dieter




More information about the R-help mailing list