lundi 24 septembre 2018

Parsing a character string condition in R

I have a character string and wants R to treat it as a logical condition to be used in an if loop.

condition <- "df$a > 2"

How can I force R to treat condition as a logical so that this if statement works?

if(condition){
  print(df$a)
}

Aucun commentaire:

Enregistrer un commentaire