1

I am a beginner in R. I am currently using random forest to do some prediction. When I read the document, it has following command lines:

iris_rf <- randomForest(Species~.,data=trainData,ntree=100,proximity=TRUE) ///// build random forest

It looks like the 'Species' is the input data set, but I don't understand, what does the "Species~." mean, particularly what is the meaning of the operator '~.' I have never seen such kind of operator before.

smci
  • 29,564
  • 18
  • 109
  • 144
lserlohn
  • 5,206
  • 10
  • 30
  • 51
  • Since you are a begginer in R, I recommend you take a look to [The Quick-R tutorial](http://statmethods.net) – Barranka Sep 24 '14 at 21:34

1 Answers1

4

[Sorry all I should have searched that the OP's question was a duplicate]

This is the syntax R uses for formulas.

All it means is that dependent variable ~ ('depends on') independent variables.

As for 'DepVar ~ .' , we use '.' instead of independent variables to signify 'all other variables in the dataset'.

smci
  • 29,564
  • 18
  • 109
  • 144