I'm trying to execute a Principal Components Analysis, but I'm getting the error: Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric
I know all the columns have to be numeric, but how to handle when you have character objects in the data set? E.g:
data(birth.death.rates.1966)
data2 <- birth.death.rates.1966
princ <- prcomp(data2)
- data2 example of data below:

Should I add a new column referring the country name to a numeric code? If yes, how to do this in R?
