r - Extracting the 7th number from a 13 digit number -


this question has answer here:

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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -