Can I pass an r variable into a function for selecting a column from the database so that different columns are selected every time the variable in r changes:
father <- 'father'
myfun(father)
Function:
myfun <- function (parent)
{
query <- paste("SELECT '$parent' from table1 where EXTRACT(YEAR FROM dob)
between '",date1,"' and '",date2,"'",sep='')
connect1 <<- dbGetQuery (con, query )
connect1
}
SELECTandparent. So maybe make the separator a single space.