ONLY DO WHAT ONLY YOU CAN DO

こけたら立ちなはれ 立ったら歩きなはれ

R で 散布図行列 ~少年サッカー データ分析~

library(psych)
psych::pairs.panels(d[,c(
"自チームの10分あたりのTOUCH数",
"相手チームの10分あたりのTOUCH数",
"自チームと相手チームのTOUCH数比率",
"自チームの10分あたりの得点",
"自チームの10分あたりの失点",
"自チームの10分あたりの得失点"
)])

f:id:fornext1119:20180215125353p:plain

library(ggplot2)
library(GGally)
ggpairs(
    d[,
        c(
            "自チームの10分あたりのTOUCH数",
            "相手チームの10分あたりのTOUCH数",
            "自チームと相手チームのTOUCH数比率",
            "自チームの10分あたりの得点",
            "自チームの10分あたりの失点",
            "自チームの10分あたりの得失点",
            "勝敗"
        )
    ],
    aes_string(
        colour="勝敗", 
        alpha=0.5
    )
)

f:id:fornext1119:20180215125303p:plain

ggpairs(
    d[,
        c(
            "自チームの10分あたりのTOUCH数",
            "相手チームの10分あたりのTOUCH数",
            "自チームと相手チームのTOUCH数比率",
            "自チームの10分あたりの得点",
            "自チームの10分あたりの失点",
            "自チームの10分あたりの得失点",
            "勝敗"
        )
    ],
    upper = list(continuous = "density", combo = "box"),
    lower = list(continuous = "points", combo = "dot"),
    aes_string(
        colour="勝敗", 
        alpha=0.5
    )
)

f:id:fornext1119:20180215125947p:plain

ggpairs(
    d[,
        c(
            "自チームの10分あたりのTOUCH数",
            "相手チームの10分あたりのTOUCH数",
            "自チームと相手チームのTOUCH数比率",
            "自チームの10分あたりの得点",
            "自チームの10分あたりの失点",
            "自チームの10分あたりの得失点",
            "勝敗"
        )
    ],
    upper = list(continuous = "density", combo = "box"),
    lower = list(continuous = "smooth", combo = "denstrip"),
    aes_string(
        colour="勝敗", 
        alpha=0.5
    )
)

f:id:fornext1119:20180215130100p:plain