Im extracting some data from a table using sql select statment in R,
query <- "select * from MyTable where TimeCol='6/29/2012 21:05' ";
result <- fn$sqldf(query);
The above code gives correct results, but when the time value is saved in variable, it doesn't works
mytime <- "6/29/2012 21:05";
query <- "select * from MyTable where TimeCol = $mytime"; # OR
query <- "select * from MyTable where TimeCol = $[mytime]"; # OR
query <- "select * from MyTable where TimeCol = '$[mytime]' ";
result <- fn$sqldf(query);
None of the above three lines is working
View(result)
it gives the error: invalid 'x' argument