The cbind method to data.frame is just a wrapper for data.frame(...). So character columns are converted to factors.
dat <- cbind(data.frame(x = 1:3), a = c("a", "b", "c"), b = c("a", "a", "c")) str(dat) ## 'data.frame': 3 obs. of 3 variables: ## $ x: int 1 2 3 ## $ a: Factor w/ 3 levels "a","b","c": 1 2 3 ## $ b: Factor w/ 2 levels "a","c": 1 1 2 dat$a == dat$b ## Error in Ops.factor(dat$a, dat$b) : level sets of factors are different as.character(dat$a) == as.character(dat$b) ## [1] TRUE FALSE TRUE dat <- cbind(data.frame(x = 1:3), a = c("a", "b", "c"), b = c("a", "a", "c"), stringsAsFactors = FALSE) str(dat) ## 'data.frame': 3 obs. of 3 variables: ## $ x: int 1 2 3 ## $ a: chr "a" "b" "c" ## $ b: chr "a" "a" "c" dat$a == dat$b ## [1] TRUE FALSE TRUE -- Noia Raindrops noia.raindr...@gmail.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.