[英]Recode multiple numeric values into new values in R
I want to recode many unique numeric values (>3000) of one column into new values.我想将一列的许多唯一数值(> 3000)重新编码为新值。 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!我正在使用 R 并且所有可用功能(例如重新编码)都需要定义所有新值! Is there a way to define the new values as a range?有没有办法将新值定义为一个范围?
values: 131181420120103, 131181420120307, 4330108120070420, 5330068820110810...值:131181420120103、131181420120307、4330108120070420、5330068820110810...
possible new values:1, 2, 3, 4, ...可能的新值:1, 2, 3, 4, ...
We can use match
on the column我们可以在列上使用match
data$col1 <- match(data$col1, unique(data$col1))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.