Skip to content
Prev 317873 / 398506 Next

creating a new variable.

Hello,

Try the following.

levels <- c("democrat", "republican", "other")
dem <- c(1,1,1,1,0,0,0,0)
rep <- c(1,1,1,0,0,0,0,0)
other <- c(1,0,0,0,0,0,0,0)

party <- factor(rep(levels, c(sum(dem), sum(rep), sum(other))))
party


Hope this helps,

Rui Barradas

Em 19-02-2013 00:01, Nicole Ford escreveu: