I have a several data sets with 75,000 observations and a type variable that can take on a value 0-4. I want to add five new dummy variables to each data set f
type
ifelse is vectorized, so if I understand your code correctly, you don't need that sapply. And I wouldn't use merge - I would use SQLite or PostgreSQL.
ifelse
sapply
Some sample data would help too :-)