Why do we mention -1 in the formula of model.matrix function from the statspackage.
training_matrix <-model.matrix(Survived ~.-1, data = training)
The standard titanic dataset is used in this case.
There is also documentation that says that one hot encoding can be performed using model.matrix with -1 notation, provided we have declared the factors and numeric in the dataset properly.
The code is as follows
data_1_matrix <-model.matrix(~.-1, data = data_1)
What does this -1 do exactly?