Thanks all. I will give them all a go and let you know the outcome.
kind regards
--
View this message in context:
http://r.789695.n4.nabble.com/Converting-column-of-strings-to-boolean-tp4656739p4656774.html
Sent from the R help mailing list archive at Nabble.com.
_
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:
Hi
I'm trying to convert a column of strings (nominal types) to
Sent: Saturday, January 26, 2013 6:27 PM
Subject: Re: [R] Converting column of strings to boolean
domcastro wrote
> Hi
>
> I'm trying to convert a column of strings (nominal types) to a set of
> boolean / binary / logical values. For example, in the column there is
> red, blue, g
Hi
I'm trying to convert a column of strings (nominal types) to a set of
boolean / binary / logical values. For example, in the column there is red,
blue, green and yellow. There are 100 rows and each has a colour. I want to
convert the column to 4 columns: red, blue, green,yellow and then either
domcastro wrote
> Hi
>
> I'm trying to convert a column of strings (nominal types) to a set of
> boolean / binary / logical values. For example, in the column there is
> red, blue, green and yellow. There are 100 rows and each has a colour. I
> want to convert the column to 4 columns: red, blue, g
5 matches
Mail list logo