Search notes:

R function: rep

foo <- 1:5

foo_x3 <- rep(foo, 3)

foo_x3
#  [1] 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5

rep(foo, each=3)
#  [1] 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5

rep(c('foo', 'bar', 'baz'), c(2, 3, 1))
# [1] "foo" "foo" "bar" "bar" "bar" "baz"
Github repository about-r, path: /functions/rep/basic.R

Creating a string of n dashes

rep together with paste can be used to create dashed strings:
cat("Underlined text\n");
cat(paste(rep('-', 15), collapse=''))
cat("\n");
Github repository about-r, path: /functions/rep/dashes.R
Underlined text
---------------

See also

seq, rep_len
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...', 1758201062, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/functions/rep(68): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78