Ordering Data

Hello, everyone!

I am still learning to use Statistical softwares and I have a question about R.
I have a data table which has one column with 5571 codes, one code in each line. Each code has 7 digits and I need to delete the last digit of each code. I want to know if I can do this in an easy way using the software R and how, because it is almost impossible to delete each number manually.
Please, I would appreciate if someone could help me telling how to do it using R or if there is another software that I could use.

Thank you!
Last edited:


Ambassador to the humans
> # Example data
> x <- c(1234567, 2629870)
> # Can convert to character and then grab the first 6 digits
> substr(as.character(x),1,6)
[1] "123456" "262987"
> # Convert back to numeric if you want
> as.numeric(substr(as.character(x),1,6))
[1] 123456 262987
> # Otherwise integer division by 10 works too
> x %/% 10
[1] 123456 262987