Hi, I still have little ability to predict how these functions will treat the columns of data frames:
> # Here's a data frame with a column "a" of integers, > # and a column "b" of characters: > df <- data.frame( + a = 1:2, + b = c("a","b") + ) > df a b 1 1 a 2 2 b > > # Except -- both columns are characters: > apply (df, 2, typeof) a b "character" "character" > > # Except -- they're both integers: > lapply (df, typeof) $a [1] "integer" $b [1] "integer" > > # Except -- only one of those integers is numeric: > lapply (df, is.numeric) $a [1] TRUE $b [1] FALSE Many thanks, Jeff -- View this message in context: http://r.789695.n4.nabble.com/Why-do-data-frame-column-types-vary-across-apply-lapply-tp2077054p2077054.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.