0

how do I change the range of a numeric variable? Now it’s 100.000-1.000000, which is way too big. It's personIDs of survey respondents. They number of observations is actually only 926.

If I don't change this, my plot looks wrongs, since it looks like I have up to 1 million observations.

Any pointers? Thanks!

dilly
  • 63
  • 1
  • 7

1 Answers1

0

You can use row_number() to create new id's.

library(dplyr)

original_id <- sample(100000:1000000,size = 5)

data.frame(original_id) %>% 
  mutate(new_id = row_number())

 original_id new_id
1      518768      1
2      367757      2
3      862740      3
4      328574      4
5      540609      5
Vinícius Félix
  • 8,448
  • 6
  • 16
  • 32