Skip to content

Instantly share code, notes, and snippets.

@nozma
Created July 24, 2016 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nozma/845a4e793b7dadf6302296a2441a4033 to your computer and use it in GitHub Desktop.
Save nozma/845a4e793b7dadf6302296a2441a4033 to your computer and use it in GitHub Desktop.
カテゴリカルデータ解析第2章練習問題解答
# 1.
# (a)
CtableS <- xtabs(~ Sex, data = Arthritis)
barplot(CtableS)
pie(CtableS, clockwise = TRUE)
# (b)
mosaicplot(~ Sex + Improved, data = Arthritis, col = TRUE)
# 3.
xtabs(Freq ~ management + own, data = JobSatisfaction)
# 4.
# (a)
xtabs(Freq ~ Age + Survived, data = Titanic)
# (b)
xtabs(Freq ~ Sex + Survived, data = Titanic[,,"Child",])
# (c)
tmp <- xtabs(Freq ~ Class + Survived, data = Titanic)
tmp[-4,]
# 5.
data.frame(Titanic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment