Search notes:

R function: lower.tri

#
#   S.a. -> upper.tri
#

m <- matrix ( rep(42, 7*5),
              nrow = 5)

m
#      [,1] [,2] [,3] [,4] [,5] [,6] [,7]
# [1,]   42   42   42   42   42   42   42
# [2,]   42   42   42   42   42   42   42
# [3,]   42   42   42   42   42   42   42
# [4,]   42   42   42   42   42   42   42
# [5,]   42   42   42   42   42   42   42

cat("\n\n")

lower.tri(m)
#       [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]
# [1,] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
# [2,]  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
# [3,]  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE
# [4,]  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE
# [5,]  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE

cat("\n\n")

m[lower.tri(m)] = 0
m
#      [,1] [,2] [,3] [,4] [,5] [,6] [,7]
# [1,]   42   42   42   42   42   42   42
# [2,]    0   42   42   42   42   42   42
# [3,]    0    0   42   42   42   42   42
# [4,]    0    0    0   42   42   42   42
# [5,]    0    0    0    0   42   42   42
Github repository about-r, path: /functions/lower.tri.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...', 1758201476, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/functions/lower_tri(73): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78