I have a data frame with character and numeric columns, when plotting a PCA later on, I need to plot character columns so I wanted to convert column "station" to character.
The data frame:
coldata <- data.frame(Location = c(West,West,East,East),
Station = c(1,2,3,4),
A = c("0.3","0.2","0.8","1"))
And the type of columns:
sapply(coldata, mode) location station A
"character" "numeric" "numeric"
I would like to have this:
sapply(coldata, mode) location station A
"character" "character" "numeric"
Can a column be labelled as "character" if containing numbers? Or would I have to convert the numbers into words: ie: 1, 2, 3,4 to one, two, three, four?
I have seen many posts converting character into numeric, but not numeric to character.