$ 0 0 The following code returns new dummy columns from a categorical variable.Create dummy columns in RDF <- data.frame(strcol = c("A", "A", "B", "F", "C", "G", "C", "D", "E", "F"))for(level in unique(DF$strcol)){ DF[paste("strcol", level, sep = "_")] <- ifelse(DF$strcol == level, 1, 0)}