I want to recode many unique numeric values (>3000) of one column into new values. The unique values appears many times in the column? I am using R and all available functions like recode need the definition of all new values! Is there a way to define the new values as a range?
values: 131181420120103, 131181420120307, 4330108120070420, 5330068820110810...
possible new values:1, 2, 3, 4, ...
We can use match
on the column
data$col1 <- match(data$col1, unique(data$col1))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.