I have an expression max(51). I want to replace the parameter in the expression i.e. 51 with the values in the database with respect to this ID. So my replaced expression will be as below:
max(dbGetQuery(con,"SELECT VALUE FROM STUD WHERE ID=51"))
where con is MySQL connection object. I have tried the following to extract the parameter from expression
PARAMETER <- gsub(".*\\((.*)\\)$", "\\1", "MAX(51)");
Now My final expression will become something like this:
max(dbGetQuery(con,"SELECT VALUE FROM STUD WHERE ID=PARAMETER"));
So how this replacement can be done in R? This is just a single operand expression. Can it be possible for more complex expressions like
max(51)+min(52)-53
Thanks..