The following code should not work, should it?
plot(1:10,1:10,main="",)
(There is an "illegal" comma at the end, right?)
The following code should not work, should it?
plot(1:10,1:10,main="",)
(There is an "illegal" comma at the end, right?)
The syntax of this statement is not illegal. R will use the parameter's default value if you provide an "empty" argument.
For example, the rnorm function takes three arguments. The latter two have default values:
rnorm(n, mean = 0, sd = 1)
The expressions
rnorm(10)
rnorm(10, )
rnorm(10, , )
are identical. However, if you add an additional comma (and therefore an additional argument), the command will fail:
rnorm(10, , , )
# Error in rnorm(10, , , ) : unused argument ()
plot.default function is used. This function has many default values.plot(,5) doesn't work but plot(5) does, while essentially it puts 5 in the y axisplot.default function has no default value for the first argument. If you omit the second argument, NULL is used by default. Have a look at the code of the function to see how this special case is treated.xy.coords comes in and tries to interpret it in a meaningful way, see Details in ?xy.coords (just found out it my self)xy.coords the default value for y is also NULL.