1
Hello,
I’m trying to make the sum of goals made and goals suffered from a set of dice, someone can help me?
Basically I have the data as follows:
Mandante Gols Feitos Gols Sofridos Visitante
Cruzeiro 0 1 Grêmio
Vitória 2 2 Flamengo
. . . .
. . . .
Fluminense 1 0 Cruzeiro
So I want to make a table, like for example:
Time Gols Feitos Gols Sofridos
Cruzeiro 0 2
Vitória 2 2
Fluminense 1 0
The question boils down to, how to add up the number of goals made when sending and the number of goals "suffered" when visiting. This is relatively simple to do for a team, but I want something that works for all teams. Any suggestions?
Data sample:
structure(list(Mandante = c("Cruzeiro", "Vitória", "Santos",
"América-MG", "Internacional", "Corinthians", "Vasco", "Atlético-
PR","São Paulo", "Botafogo", "Bahia", "Flamengo", "Fluminense", "Paraná",
"Ceará", "Chapecoense", "Palmeiras", "Atlético-MG", "Grêmio",
"Sport"), `Gols feitos` = c(0, 2, 2, 3, 2, 2, 2, 5, 1, 1, 1,
2, 1, 0, 0, 1, 1, 2, 0, 1), `Gols sofridos` = c(1, 2, 0, 0, 0,
1, 1, 1, 0, 1, 0, 0, 0, 4, 0, 1, 0, 1, 0, 1), Visitante = c("Grêmio",
"Flamengo", "Ceará", "Sport", "Bahia", "Fluminense", "Atlético-MG",
"Chapecoense", "Paraná", "Palmeiras", "Santos", "América-MG",
"Cruzeiro", "Corinthians", "São Paulo", "Vasco", "Internacional",
"Vitória", "Atlético-PR", "Botafogo")), row.names = c(NA, -20L
), class = c("tbl_df", "tbl", "data.frame"))