I\'m looking for how to do printf in r, ie I want to type:
printf(\"hello %d\\n\", 56 )
and get the same output as typing:
My solution:
> printf <- function(...) cat(sprintf(...))
> printf("hello %d\n", 56)
hello 56
The answers given by Zack and mnel print the carriage return symbol as a literal. Not cool.
> printf <- function(...) invisible(print(sprintf(...)))
> printf("hello %d\n", 56)
[1] "hello 56\n"
>
> printf <- function(...)print(sprintf(...))
> printf("hello %d\n", 56)
[1] "hello 56\n"