0

I'm learning how to use the car package in R and I've run into a minor format/syntactical issue with regards to using the scatterplot() function. My personal preference when using functions in R is to use the name of the arguments when applying the function. So in this case I would write:

scatterplot(formula = prestige ~ income, data = Prestige, id = list(n = 4))

When I do this I am shot the error:

  > Error in scatterplot(formula = prestige ~ income, data = Prestige, id = list(n = 4)): 
   argument "x" is missing, with no default

But when writing the function without the formula argument in particular:

scatterplot(prestige ~ income, data = Prestige, id = list(n = 4))

Everything goes through just fine.

I'm trying to understand why this is the case? I have read up from a previous post on the difference between using = and <- as assignment operators in What are the differences between "=" and "<-" assignment operators in R?, but I don't think that is what is happening here. Is there a way to reconcile this? I do like to keep things along the lines of best practices so I don't fall into lazy habits.

D.C. the III
  • 340
  • 3
  • 14

0 Answers0