make numeric column from 100,101,102,.... rather than 1,2,3,4,...

I have data set whose is grouped by a column called SAMPN. I did use the following code to make it numeric,

             df1$SAMPN<-data.table::rleid(df1$SAMPN)

but it starts from 1 , can I do something that number start from 100?

Try

df1$SAMPN <- data.table::rleid(df1$SAMPN) + 99
1 Like

Error in gf1$SAMPN : $ operator is invalid for atomic vectors

You are making a typo, your first example says df1$SAMPN and now you are typing gf1$SAMPN