• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


28 Feb, 2025

Updated at 21 Mar, 2025

Calling variable in df within function

I'm getting the error message that "cyl" not found. Pretty sure it has to do with tidy eval, but I can't figure out what else I need to do.

check_percent_fun = function(df, var){
  
apply(df, MARGIN=2, stopifnot("not greater than 0" =
            {{var}} > 0 )
)
}

check_percent_fun(mtcars, cyl)