1. Learn
  2. /
  3. Kurser
  4. /
  5. Optimizing R Code with Rcpp

Connected

övning

Print to the console

You can use Rprintf() to print formatted output to the console. It is similar to the sprintf() function in R, and uses the format specifiers:

  • %d to specify an integer
  • %s to specify a string

Instruktioner

100 XP

Write a function that adds two integers (x and y) and prints the following message about it:

** <x> + <y> = <x + y>