r - Extracting the 7th number from a 13 digit number -
this question has answer here:
- using substring on column in r 1 answer
i want extract 7th number 13 digit number.for instance 9111110123341, 0 7th number , have if statement saying if number between 0 , 5 assign m new column . possible in r?
don't use text processing functions numeric operations:
extract_digit <- function(x, n) floor(x / 10^(ceiling(log10(x)) - n )) - floor(x / 10^(ceiling(log10(x)) - n + 1)) * 10 extract_digit(9111110123341, 7:10) #extract 7th 10th digits #[1] 0 1 2 3
Comments
Post a Comment