Warning message when performing a random forest to predict the Survived column in Titanic dataset

Why am I getting this warning message when performing a randomForest to predict the Survived column in Titanic dataset (code to follow)?

In randomForest.default(m, y, …) :
The response has five or fewer unique values. Are you sure you want to do regression?

titanic.data <- titanic.data[, -c(1, 4, 9, 11)]
titanic.data$Age[is.na(titanic.data$Age)] <- median(titanic.data$Age, na.rm=TRUE)
titanic.data$Fare[is.na(titanic.data$Fare)] <- median(titanic.data$Fare, na.rm=TRUE)
train.index <- sample(1:nrow(titanic.data), 0.7*nrow(titanic.data))
titanic.train <- titanic.data[train.index,]
titanic.test <- titanic.data[-train.index,]
titanic.rf.model <- randomForest(Survived ~., data=titanic.train) ```

There are more than one explanations.

Possibly, your data is in a vector which is why it appears to be shallow. You need to transform it so it becomes a dataframe.

R is warning you that there is too little data.