powered by
This function checks if your vector is not a character and if it is, then converts it to a numeric.
toNum(x)
toNum Returns a numeric vector.
toNum
A character, factor, or numeric vector.
# vector of factors fact <- factor(c("1", "2", "3", "4")) # convert to numeric num <- toNum(x = fact)
Run the code above in your browser using DataLab