Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created March 18, 2020 19:20
Show Gist options
  • Select an option

  • Save NyaGarcia/949fa4d18ac49f090375384cab1b5720 to your computer and use it in GitHub Desktop.

Select an option

Save NyaGarcia/949fa4d18ac49f090375384cab1b5720 to your computer and use it in GitHub Desktop.
Calculating total values for rows and columns with addmargins()
> addmargins(table(mtcars$gear, mtcars$cyl))
4 6 8 Sum
3 1 2 12 15
4 8 4 0 12
5 2 1 2 5
Sum 11 7 14 32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment