R/utils.R
has_col.Rd
Detect if df has col
has_col(df, col)
A dataframe.
A string or string vector.
colnames(mtcars) #> [1] "mpg" "cyl" "disp" "hp" "drat" "wt" "qsec" "vs" "am" "gear" #> [11] "carb" has_col(mtcars, c("mpg", "cyl")) #> [1] TRUE has_col(mtcars, c("mpg", "foo")) #> Warning: not found col foo in df #> [1] FALSE