How do I test if a data.frame has a column named X? exists(o) checks if the object exists or not, I want to test if a data.frame object (df) has a column names(X), something like: exists(df$X)