Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
library(fmsb)
# all data taken from basketball-reference.com
curry_now <- read.table(text="Season,Age,Tm,Lg,Pos,G,GS,MP,FG,FGA,FG%,3P,3PA,3P%,2P,2PA,2P%,eFG%,FT,FTA,FT%,ORB,DRB,TRB,AST,STL,BLK,TOV,PF,PTS
2015-16,27,GSW,NBA,PG,20,20,34.3,10.6,20.2,.524,5.1,11.1,.459,5.5,9.1,.602,.650,5.8,6.2,.943,0.5,4.6,5.1,6.0,2.4,0.2,3.6,1.7,32.0",sep=",",dec=".",header=T)
jordan_93 <- read.table(text="Season,Age,Tm,Lg,Pos,G,GS,MP,FG,FGA,FG%,3P,3PA,3P%,2P,2PA,2P%,eFG%,FT,FTA,FT%,ORB,DRB,TRB,AST,STL,BLK,TOV,PF,PTS
1992-93,29,CHI,NBA,SG,78,78,39.3,12.7,25.7,.495,1.0,2.9,.352,11.7,22.7,.514,.515,6.1,7.3,.837,1.7,5.0,6.7,5.5,2.8,0.8,2.7,2.4,32.6
",
header = T,sep=",",dec=".")
comp <- data.frame(
curry = c(age = curry_now$Age, pts = curry_now$PTS,pct_FT = curry_now$FT.*100,
pct_FG = curry_now$FG.*100, pct_3PT = curry_now$X3P.*100, ast = curry_now$AST,
reb = curry_now$TRB),
jordan = c(age = jordan_93$Age, pts = jordan_93$PTS,pct_FT = jordan_93$FT.*100,
pct_FG = jordan_93$FG.*100, pct_3PT = jordan_93$X3P.*100, ast = jordan_93$AST,
reb = jordan_93$TRB)
)
tcomp <- data.frame(t(comp))
par(mfrow=c(1,2))
radarchart(rbind(rep(100,7),rep(0,7),tcomp[1,-c(6,7)]),
pdensity=40,title = "Steph Curry Scorer Profile")
radarchart(rbind(rep(100,7),rep(0,7),tcomp[2,-c(6,7)]),
pdensity=40,title = "Michael Jordan 93 Scorer Profile")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment