I am trying to add title for all my plot in a loop, here is what I have done:
first I split the data with the split()
fuction:
sep_team_season_stage <- split(data[cols],
list(data$Season,data$Stage,data$Team),drop = TRUE)
then I want to plot a bunch of radar graph: so I use a loop:
for (i in sep_team_season_stage){
print(ggRadar(i, aes(group = "Team")))
}
And then I want to add tilte for the graph: I saw "titles" produces by the split function is good so I want to recall them:
plotnames = names(sep_team_season_stage)
and added into the for loop:
for (i in sep_team_season_stage){
a=1,
print(ggRadar(i, aes(group = "Team"))+ ggtitle(plotnames[a])),
a= a+1
}
It doesnt work however, how can I fix it?