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.
一部の数値を別の数値に再コード化したいので、次のコードを使用してみました。
survey$KY27PHYc <- revalue(survey$KY27PHY1, c(5=3, 4=2,3=2,2=1,1=1))
次のエラーが表示されます。
## Error: unexpected '=' in "survey$KY27PHYc <- revalue(survey$KY27PHY1, c(5="
どこが間違っていますか?
この関数は、数値ベクトルでは機能しません。使用したい場合は、次のようにします。
x <- 1:10 # your numeric vector as.numeric(revalue(as.character(x), c("2" = "33", "4" = "88"))) # [1] 1 33 3 88 5 6 7 8 9 10