I have a data set, dt.train2 with 1500 different observations and 130 variables. One of them is languages and it can be english, french, arabic...
I want to create a ifelse string that gives attributes 1 for english, 2 for french, 3 for spanish and 0 for anything else. I have no idea how to do it.
dt.train2[, language_string := ifelse(language == "english",
1,
ifelse(language == "french",
2,
ifelse(language == "spanish",3)]
I'm using this to run linear model about sales.