Created
March 18, 2020 19:20
-
-
Save NyaGarcia/949fa4d18ac49f090375384cab1b5720 to your computer and use it in GitHub Desktop.
Calculating total values for rows and columns with addmargins()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > 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