My apologies if this is a fuzzy question, as I am new to R. When experimenting with R, I found one strange behavior. When I create a function like:
myfunction <- function(a,b){ print(a,b) }
and name it like this:
myfunction(b = 10, a = 20)
it returns with a result of 20, but if I just call it without a function, assigning it directly to variables like:
a <- 20 b <- 10 print(a, b)
I get an error message:
Error in print.default(a, b) : invalid 'digits' argument
In addition, I read that printing several variables on one line can be done with:
sprintf("%i %i",a, b)
So, is this an error that appears in a function call with the result as the first argument?
source share