事前準備
#パッケージの読み込み
library("rpivotTable")
###データ例の作成#####
n <- 100
TestDF <- data.frame(Group = sample(paste0("テスト", 1:10), n, replace = TRUE),
Data1 = sample(1:10, n, replace = TRUE),
データ2 = rnorm(n),
Data3 = sample(1:10, n, replace = TRUE),
Data4 = sample(1:10, n, replace = TRUE))
#####
システム環境
sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.1 (El Capitan)
locale:
[1] ja_JP.UTF-8/ja_JP.UTF-8/ja_JP.UTF-8/C/ja_JP.UTF-8/ja_JP.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rpivotTable_0.1.5.7
loaded via a namespace (and not attached):
[1] htmlwidgets_0.5 magrittr_1.5 formatR_1.2.1 tools_3.2.2
[5] htmltools_0.2.6 yaml_2.1.13 stringi_1.0-1 rmarkdown_0.8.1
[9] knitr_1.11 stringr_1.0.0 digest_0.6.8 evaluate_0.8
コマンドの実行
#ピボットテーブルのプロット
rpivotTable(TestDF, rows = colnames(TestDF[1]), cols = colnames(TestDF[4]), width = "100%", height = "400px")