Last chance! 50% off unlimited learning
Sale ends in
C-style formatted output.
# S3 method for default
printf(fmt, ..., sep="", file="")
Additional arguments sprintf
().
A connection
, or a character
of a file to print to.
See same argument for cat
().
Returns nothing.
# NOT RUN {
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))
# }
Run the code above in your browser using DataLab