My data consists of data about smartphones.
To do a random forest
, I need to convert my factor Brand into a lot of dummies.
I tried this code
m <- model.matrix( ~ Brand, data = data_price)
Intercept BrandApple BrandAcer BrandAlcatel ...
1 0 0 1
1 1 0 0
...
The problem is that the original data has 2039 rows, while the output of this only has 2038.
Now I want to add the dummies to my data_price
, but this doesn't works.
How could I make a dummy and add it to my data set?