printf | R Documentation |
C-style formatted output.
## Default S3 method:
printf(fmt, ..., sep="", file="")
fmt |
A |
... |
Additional arguments |
sep |
A |
file |
A |
Returns nothing.
Henrik Bengtsson
For C-style formatting of character
strings, see sprintf
().
cat("Hello world\n")
printf("Hello world\n")
x <- 1.23
cat(sprintf("x=%.2f\n", x))
printf("x=%.2f\n", x)
y <- 4.56
cat(sprintf(c("x=%.2f\n", "y=%.2f\n"), c(x,y)), sep="")
printf(c("x=%.2f\n", "y=%.2f\n"), c(x,y))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.