Convert written number to number in R

Here’s a start that should get you to hundreds of thousands. word2num <- function(word){ wsplit <- strsplit(tolower(word),” “)[[1]] one_digits <- list(zero=0, one=1, two=2, three=3, four=4, five=5, six=6, seven=7, eight=8, nine=9) teens <- list(eleven=11, twelve=12, thirteen=13, fourteen=14, fifteen=15, sixteen=16, seventeen=17, eighteen=18, nineteen=19) ten_digits <- list(ten=10, twenty=20, thirty=30, forty=40, fifty=50, sixty=60, seventy=70, eighty=80, ninety=90) doubles <- c(teens,ten_digits) … Read more