strings as factors
Hi, To be able to match cases with a benchmark I need to have a data.frame with a character id variable. however, I am surprised why this seems to be so hard. In fact I was unable to succeed. Here is what I tried:
test1 <-expand.grid(ID = 1:2, sex = c("male","female"))
is(test1[,2])
[1] "factor" "oldClass"
test2 <-expand.grid(ID = 1:2, sex = c('male','female'))
is(test2[,2])
[1] "factor" "oldClass"
test3 <-expand.grid(ID = 1:2, sex = I(c("male","female")))
is(test3[,2])
[1] "factor" "oldClass"
test4 <-expand.grid(ID = 1:2, sex = I(c('male','female')))
is(test4[,2])
[1] "factor" "oldClass"
options(stringsAsFactors = FALSE)
options("stringsAsFactors")
$stringsAsFactors [1] FALSE
test5 <-expand.grid(ID = 1:2, sex = I(c('male','female')))
is(test5[,2])
[1] "factor" "oldClass" is there anyway I can get sex to be a character? Arnab _________________________________________________________________ Visit MSN Holiday Challenge for your chance to win up to $50,000 in Holiday