Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 dataset$SITE 有 100 行,其中包含独特的元素“North”、“South”和“East Bar”。如何将所有带有“East Bar”的行更改为“East”?
levels(dataset$SITE)[1] = "East"
如果dataset$SITE是 a factor,那么您想按照@DavidRobinson 的建议进行操作。 否则,您要使用以下内容。
dataset$SITE
factor
dataset$SITE[dataset$SITE == "East Bar"] <- "East"
请注意,检查您是否正在处理一个因素的众多方法之一:
is.factor(dataset$SITE)