[R] creating a new variable.
nicole.ford at me.com
Tue Feb 19 01:01:05 CET 2013
in my previous research, i have always used existing data. i am trying something new as an exploratory exercise and have never create my own variable form scratch.
essentially, i am creating a variable for party affiliation.
here is an example.
levels= democrat, republican, other.
respondents will indicate which category they fall under.
for the sake of ease, i will use small data as an example.
i was thinking the levels would need to be created first-
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)
then, i could do:
party <-cbind(den, rep, other)
this is where i am getting stuck... any thoughts would be appreciated.
i promise this isn't homework. i am trying to understand how i would go about creating variables if i choose to go in this direction in the future... and work out the kinks now.
More information about the R-help