[R] Insert variable in RMySQL-Statement

Arne H. Schulz mail at arnehendrikschulz.de
Wed Feb 9 10:09:34 CET 2011


Dear list,
I'm working with a MySQL-Table and would like to extract selected ids that are stored in a vector:
Ids <- c(1,2,3)

How do I insert this variable in a for loop like this:

For (a in values) {
	Temp <- dbGetQuery(con,
		"select * from db
			Where id = <ID>";)
}

My problem is to split the select-statement and insert the current id. How can I handle this problem?

Best regards,
Arne



More information about the R-help mailing list