I have the following data frame:
name1 name2
A B
B D
C C
D A
the columns \"name1\"
you're looking for as.character, which you need to apply to each column of the data.frame
Assuming X is your data.frame
If fctr.cols are the names of your factor columns, then you can use:
X[, fctr.cols] <- sapply(X[, fctr.cols], as.character)
You can collect your factor columns using is.factor:
fctr.cols <- sapply(X, is.factor)