# How to use weights for imbalanced data in R's randomForest?

I have a data set that is imbalanced and would like to weight the samples to compensate, however I can't find code to implement this in R though I believe there is a feature in the randomForest package to do this.

Here's a sample dataset :

id      buy=1/noBuy=0    timeOnSite(sec.)     clicksOnSite      estAge
1             0              150                   12             44
2             0              342                   56             23
3             0               33                   11             18
4             1              167                   34             27
5             0               95                    3             52
6             0              254                   98             26
7             0              982                    4             36
8             0               72                    6             22
9             1              259                   62             48
10            0              438                  104             24
...


I'm trying to predict the buy/noBuy column but the real data is even more imbalanced than this. Anyone know of an example written in R to deal with a similar situation?

Ok, so I found part of my answer but not the good part. It turns out the randomForest package can do stratified sampling but only for classification. Here is a link to the package author's explanation.