On Thu, 19 May 2005 [EMAIL PROTECTED] wrote:
There may be a simpler way, but this
is.na(match("X", names(df)))
should return TRUE if the column name exists and FALSE otherwise.
Mere syntactic sugar, but "X" %in% names(mydf) is self-documenting.
How do I test if a data.frame has a column named X?
ex
Subject
[R] does column exist?
at.math.ethz.ch
Subject
[R] does column exist?
05/19/2005 12:42
How about is.null(df$X)==FALSE ?
Omar Lakkis wrote:
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)
__
R-help@
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)
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch