suppose "state" is a variable in a dataframe containing abbreviations of the US states, as a factor. What I'd like to do is to include dummy variables for a few of the states, (say, CA and MA) among the independent variables in my regression formula. (This would be the equivalent of, creating, eg, ca<-state=="CA") and then including that). I know I can create all the necessary dummy variables by using the "outer" function on the factor and then renaming them appropriately; but is there a solution that's more direct, ie that doesn't involve a lot of new variables?

Thanks!


------------------------
Philip A. Viton
City Planning, Ohio State University
275 West Woodruff Avenue, Columbus OH 43210
vito...@osu.edu

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to