[R] creating a new variable.
jim at bitwrit.com.au
Tue Feb 19 03:17:09 CET 2013
On 02/19/2013 11:01 AM, Nicole Ford wrote:
> hello, all.
> 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.
> var =party.
> levels= democrat, republican, other.
> this is where i am getting stuck... any thoughts would be appreciated.
The usual way something like this is done is to create a factor of a
given size with the appropriate levels:
 dem dem dem rep oth dem dem oth rep dem rep rep oth dem oth oth
 oth rep oth rep dem oth rep dem oth oth oth oth rep dem oth dem
 dem oth dem oth rep oth rep oth rep dem dem rep rep rep dem oth
 oth dem rep dem rep oth rep oth dem dem dem rep dem rep dem oth
 rep dem rep rep rep dem oth oth oth rep oth rep oth oth dem oth
 rep rep oth dem rep dem dem oth dem dem
Levels: dem oth rep
More information about the R-help