------------------------
#step 1
a=MinutesPlayed[c(1,3),,drop=F]
matplot(t(a),type = "b",pch = 18:20,col = c(1:10,6))
legend("bottomleft",inset=.01,legend = Players[c(1,3)],pch = 18:20,col = c(1:10,6),horiz = FALSE )
#step2
a=MinutesPlayed[c(1),,drop=F]
matplot(t(a),type = "b",pch = 18:20,col = c(1:10,6))
legend("bottomleft",inset=.01,legend = Players[c(1)],pch = 18:20,col = c(1:10,6),horiz = FALSE )
# step3
myvlr<- function()
{
a=MinutesPlayed[c(1,3),,drop=F]
matplot(t(a),type = "b",pch = 18:20,col = c(1:10,6))
legend("bottomleft",inset=.01,legend = Players[c(1,3)],pch = 18:20,col = c(1:10,6),horiz = FALSE )
}
myvlr()
#step 4
myvlr<- function(z)
{
a=MinutesPlayed[z,,drop=F]
matplot(t(a),type = "b",pch = 18:20,col = c(1:10,6))
legend("bottomleft",inset=.01,legend = Players[z],pch = 18:20,col = c(1:10,6),horiz = FALSE )
}
myvlr(c(4:7,9))
#step5
myvlr<- function(m,z)
{
a=m[z,,drop=F]
matplot(t(a),type = "b",pch = 18:20,col = c(1:10,6))
legend("bottomleft",inset=.01,legend = Players[z],pch = 18:20,col = c(1:10,6),horiz = FALSE )
}
myvlr(Points,c(1:2,4))
myvlr(FieldGoalAttempts/FieldGoals,c(1))
Points
#step 6
myvlr<- function(m,z=c(1:5))
{
a=m[z,,drop=F]
matplot(t(a),type = "b",pch = 18:20,col = c(1:10,6))
legend("bottomleft",inset=.01,legend = Players[z],pch = 18:20,col = c(1:10,6),horiz = FALSE )
}
myvlr(Points)
No comments:
Post a Comment