I have a csv file, with columns with numbers for e.g. 330789,340789
but in between there is a number with only 5 digits for e.g 41896
.
I want to remove the first digit from every 6 digit number from the entire column.
How could I go about this?
I have a csv file, with columns with numbers for e.g. 330789,340789
but in between there is a number with only 5 digits for e.g 41896
.
I want to remove the first digit from every 6 digit number from the entire column.
How could I go about this?
If the column elements are 6-digit divide each element by 10^5. If column element is less than 6-digit then do nothing.
#let us say the data frame is df. column containing 6 digit numbers is col1
library(dplyr)
df <- df %>%
mutate(
col1 = ifelse((col1 / 100000) > 0 , col1%%100000,col1 )
)
print(df)