Home > Blockchain >  How to remove zeros from zero-left numbers (leading zeros) in a dataframe?
How to remove zeros from zero-left numbers (leading zeros) in a dataframe?

Time:01-18

I have this dataframe

df = data.frame(x = c('01','02','03','04','05'))
df

And the objective is to have the output as follows :

  x
1 1
2 2
3 3
4 4
5 5

CodePudding user response:

Use this

df$x <- as.integer(df$x)
  • Related