printf.Rd
C-style formatted output.
# S3 method for default
printf(fmt, ..., sep="", file="")
Returns nothing.
cat("Hello world\n")
#> Hello world
printf("Hello world\n")
#> Hello world
x <- 1.23
cat(sprintf("x=%.2f\n", x))
#> x=1.23
printf("x=%.2f\n", x)
#> x=1.23
y <- 4.56
cat(sprintf(c("x=%.2f\n", "y=%.2f\n"), c(x,y)), sep="")
#> x=1.23
#> y=4.56
printf(c("x=%.2f\n", "y=%.2f\n"), c(x,y))
#> x=1.23
#> y=4.56