Search notes:

R function: prop.table

options("digits"=2)

m <- matrix (
       c(  1, 3, 1,
           7, 3, 5),
       ncol  = 3,
       byrow = TRUE
)

prop.table(m)
#      [,1] [,2] [,3]
# [1,] 0.05 0.15 0.05
# [2,] 0.35 0.15 0.25

prop.table(m, 1)
#      [,1] [,2] [,3]
# [1,] 0.20  0.6 0.20
# [2,] 0.47  0.2 0.33

prop.table(m, 2)
#      [,1] [,2] [,3]
# [1,] 0.12  0.5 0.17
# [2,] 0.88  0.5 0.83
Github repository about-r, path: /functions/prop.table.R

See also

Index to (some) R functions

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759406590, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/functions/prop_table(61): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78