Slide 3
Slide 3 text
GLUING STRINGS IN R IS PAINFUL
GLUING STRINGS IN R IS PAINFUL
apples <- 3
bananas <- 2
paste0("Inventory", "\n",
" Apples: ", apples, "\n",
" Bananas: ", bananas, "\n",
"Total: ", apples + bananas)
## Inventory
## Apples: 3
## Bananas: 2
## Total: 5
sprintf("Inventory\n Apples: %i\n Bananas: %i\nTotal: %i",
apples, bananas, apples + bananas)
## Inventory
## Apples: 3
## Bananas: 2
## Total: 5
if (!file.exists(file)) {
stop("'", file, "' not found")
}