R, expanding M prefixes into 1000 -


one of columns of dataframe contains numerical values, of contaim "m" prefixes 10^6 representation.

>col ... [1177] "38141"  "39171"  "37019"  "38396"  "28390"  "29157"  "10876"  "28307"  "0"      "0"      "0"      "1.4 m"  [1189] "0"      "0"      "1.5 m"  "36660"  "37650"  "94"     "89672"  "89898"  "34962"  "35907"  "40170"  "41255"  

how can expand them make full columns of numerical values? used strsplit , temp variables storing separate list

>spl_col<-strsplit(col, " ") 

but end list keys of contain 2 values. no idea next. appreciate assistance

i replace m (notice space) e6 , coerce numeric.

> x <- c("3", "4", "1.5 m") > as.numeric(gsub(pattern = " m", replacement = "e06", x = x)) [1]       3       4 1500000 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -