R/loonGrob_l_serialaxes.R
char2num.data.frame.Rd
Turn a data frame of characters to a data frame of numerical values. If the character cannot be converted to numerical in direct, it will be turned to factor first, then to numerical data
char2num.data.frame(chardataframe)
chardataframe | A char data frame |
---|
data <- data.frame(x = c("1", "2", "3"), y = c("foo", "bar", "foo"), z = 4:6) # ERROR # data + 1 numData <- char2num.data.frame(data) numData + 1#> x y z #> 1 2 2 5 #> 2 3 1 6 #> 3 4 2 7if(interactive()) { s <- l_serialaxes(iris) data <- s["data"] # it is a character data frame data[1,1] numData <- char2num.data.frame(data) numData[1,1] }