R_カテゴリを融合する のバックアップ(No.1) - アールメカブ

アールメカブ


R_カテゴリを融合する のバックアップ(No.1)


Rの備忘録

faraway, chapter 5, p.98

 library(faraway)
# p.98
data(nes96)
head(nes96)
sPID <- nes96$PID
levels(sPID)
# [1] "strDem"  "weakDem" "indDem"  "indind"  "indRep"
     "weakRep" "strRep"
levels(sPID) <- c("Democrat", "Democrat", "Independent",
    "Independent",  "Independent",  "Republican",  "Republican")