model.matrix error

Hello, could you help me how to solve this error?
I'm just trying to use 'model.matrix'. But it shows me 'Unexpected Symbol'.
I try all my way.. How can I do it?

car.total <- model.matrix(~0 + Fuel Type + Color, data=car.total)

why is there a zero 0 in there ?

  1. if Fule Type is the name of the column, you should put it between ` chars because of the empty space. -> `Fule Type` instead of Fule Type

  2. something else: is the argument data = car.total correct? because I do not see, where you load or generate car.total before calling model.matrix()?

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

I'm not good at Rstudio. I just learned it for a few days. so...I don't know why a zero in here... My professor just told me input that.