Skip to content
Prev 316244 / 398502 Next

Converting column of strings to boolean

Hello,

Something like this?


x <- sample(c("red", "blue", "green", "yellow"), 100, replace = TRUE)
cnames <- unique(x)
sapply(cnames, function(.x) x == .x)


Hope this helps,

Rui Barradas

Em 26-01-2013 22:25, domcastro escreveu: