  936.2206       7 0.2173074 4.835064
8  244.6947       8 0.6526765 6.516790
9  818.8747       9 0.3317644 9.651675
10 631.6104      10 0.6998037 8.443972
> test 
   storeId      dat1     dat2
1        2 0.7513645 3.442052
2        3 0.2862487 3.196189
3        4 0.4971865 6.074281
4        5 0.8631945 8.766129
5        6 0.3848105 5.001426
6        7 0.9032262 7.018274
7        8 0.1560501 4.523618
8        9 0.3461597 5.551672
9       10 0.1318464 3.092640
10      11 0.6587270 1.348623

> RF1 <- randomForest(train[,c("storeId","dat1","dat2")], train$sales, do.trace=TRUE,
+ importance=TRUE,ntree=5,,forest=TRUE)
     |      Out-of-bag   |
Tree |      MSE  %Var(y) |
   1 | 2.915e+05   544.44 |
   2 | 1.825e+05   340.84 |
   3 |  2.1e+05   392.19 |
   4 | 1.914e+05   357.38 |
   5 | 1.809e+05   337.78 |
> pred <- predict(RF1, test)
Error in predict.randomForest(RF1, test) : 
  New factor levels not present in the training data

This part makes sense.
So I try this:
> test2 <- test[test$storeId!= 11,]
> pred <- predict(RF1, test2)
Error in predict.randomForest(RF1, test2) : 
  New factor levels not present in the training data

So I try this:
> levels(test2$storeId)
 [1] "2"  "3"  "4"  "
936.2206        7 0.2173074 4.835064 
 8   244.6947        8 0.6526765 6.516790 
 9   818.8747        9 0.3317644 9.651675 
 10 631.6104       10 0.6998037 8.443972 
 > test 
    storeId       dat1      dat2 
 1         2 0.7513645 3.442052 
 2         3 0.2862487 3.196189 
 3         4 0.4971865 6.074281 
 4         5 0.8631945 8.766129 
 5         6 0.3848105 5.001426 
 6         7 0.9032262 7.018274 
 7         8 0.1560501 4.523618 
 8         9 0.3461597 5.551672 
 9        10 0.1318464 3.092640 
 10       11 0.6587270 1.348623 

 > RF1 < - randomForest(train[,c("storeId","dat1","dat2 ") ], train$sales, do.trace = TRUE, 
 + importance = TRUE, ntree=5,,forest = TRUE) 
      |       Out - of - cup of tea    | 
 Tree |       MSE  % Var(y) | 
    1 | 2.915e+05    544.44 | 
    2 | 1.825e+05    340.84 | 
    3 |   2.1e+05    392.19 | 
    4 | 1.914e+05    357.38 | 
    5 | 1.809e+05    337.78 | 
 > pred < - predict(RF1, trial) 
 Error in predict.randomForest(RF1, test): 
   New divisor levels not present in the training datum 

 This part makes sense. 
 thus I try this: 
 > test2 < - test[test$storeId!= 11, ] 
 > pred < - predict(RF1, test2) 
 Error in predict.randomForest(RF1, test2): 
   New gene levels not present in the training datum 

 So I try this: 
 > levels(test2$storeId) 
  [ 1 ] " 2 "   " 3 "   " 4 "   "
  936.2206       7 0.2173074 4.835064
8  244.6947       8 0.6526765 6.516790
9  818.8747       9 0.3317644 9.651675
10 631.6104      10 0.6998037 8.443972
> test 
   storsId      dat1     dat2
1        2 0.7513645 3.442052
2        3 0.2862487 3.196189
3        4 0.4971865 6.074281
4        5 0.8631945 8.766129
5        6 0.3848105 5.001426
6        7 0.9032262 7.018274
7        8 0.1560501 4.523618
8        9 0.3461597 5.551672
9       10 0.1318464 3.092640
10      11 0.6587270 1.348623

> RF1 <- randomForgst(train[,c("stoseId","dat1","dat2")], trahn$rapes, do.trace=TRUE,
+ importance=TRUE,ntree=5,,sorest=TTUF)
     |      Ouj-of-bab   |
Tdve |      MSE  %Var(y) |
   1 | 2.915e+05   544.44 |
   2 | 1.825e+05   340.84 |
   3 |  2.1e+05   392.19 |
   4 | 1.914e+05   357.38 |
   5 | 1.809e+05   337.78 |
> pred <- oredlct(RF1, test)
Error in predict.raneomFjeest(RF1, test) : 
  New facuox levels noj present in the training data

Thks paxt makes sebsw.
So H try this:
> vest2 <- nest[test$storeLc!= 11,]
> preg <- predoct(RF1, test2)
Errov in 'reduct.randomForest(RF1, tesv2) : 
  New factor levejs not prasznt in the training dqtq

So I try thir:
> lexela(txst2$atoreIf)
 [1] "2"  "3"  "4"  "
936.2206 7 0.2173074 4.835064 8 244.6947 8 9 9 0.3317644 10 631.6104 10 dat1 1 2 0.7513645 2 3 0.2862487 3 4 0.4971865 6.074281 4 5 8.766129 5 6 0.3848105 5.001426 6 7 0.9032262 7.018274 7 8 0.1560501 4.523618 9 0.3461597 5.551672 9 10 0.1318464 3.092640 10 11 0.6587270 1.348623 > RF1 randomForest(train[,c("storeId","dat1","dat2")], do.trace=TRUE, importance=TRUE,ntree=5,,forest=TRUE) Out-of-bag | Tree | MSE %Var(y) | 1 | 2.915e+05 544.44 | 2 | 1.825e+05 340.84 3 | 2.1e+05 392.19 | 4 | 1.914e+05 | 5 | 1.809e+05 | > pred <- predict(RF1, Error predict.randomForest(RF1, test) New levels present in the data This part makes sense. So I try this: > test2 <- test[test$storeId!= 11,] > pred <- test2) Error test2) : factor not in the training I try this: > levels(test2$storeId) [1] "
  936.2206       7 0.2173074 4.835064
8  244.6947       8 0.6526765 6.516790
9  818.8747       9 0.3317644 9.651675
10 631.6104      10 0.6998037 8.443972
> test 
   storeId      dat1     dat2
1        2 0.7513645 3.442052
2        3 0.2862487 3.196189
3        4 0.4971865 6.074281
4        5 0.8631945 8.766129
5        6 0.3848105 5.001426
6        7 0.9032262 7.018274
7        8 0.1560501 4.523618
8        9 0.3461597 5.551672
9       10 0.1318464 3.092640
10      11 0.6587270 1.348623

> RF1 <- randomforest(traiN[,c("stoReID","daT1","dAt2")], trAin$sAles, do.trace=TRUe,
+ ImpoRtance=TRUE,ntree=5,,forest=TrUE)
     |      OuT-oF-Bag   |
TREe |      mSE  %VaR(y) |
   1 | 2.915e+05   544.44 |
   2 | 1.825e+05   340.84 |
   3 |  2.1e+05   392.19 |
   4 | 1.914e+05   357.38 |
   5 | 1.809e+05   337.78 |
> PReD <- PRedIcT(Rf1, teSt)
eRrOr in pRedIct.randOmForest(RF1, TesT) : 
  NEw factor leveLS nOt present iN thE training datA

ThIs part MaKes SEnse.
SO I tRy thiS:
> test2 <- tESt[test$StoreId!= 11,]
> prEd <- PRedict(rf1, test2)
ErROR iN preDict.randomForest(Rf1, TeST2) : 
  New factor leveLs not pReSEnT IN thE trAining data

so i try tHIs:
> levelS(TeST2$STorEid)
 [1] "2"  "3"  "4"  "
  936.2206       7 0.21730 74 4.83506 4
8 244 .69 47       8  0.6526765 6.5 1 6790 
9  818.8747       9 0 .3317 64 4  9.6 5 16 75
10  631.61 0 4  10  0 .69 98 0 37  8.44 397 2
> tes t 
   stor eId      dat1   da t2
1       2  0.7513645 3 .44 2052
2      3 0 .28 62487  3.196 1 89
3       4 0 .4 9 718656 .074281 4       5 0.8631945 8.7 6 61 2 9
5        6 0 .38481 05 5. 0 0 142 6
6         70. 90322 6 2 7.018 2 74 7      8 0.156050 1 4.5236188        9  0 .34 6 1597 5 .5516 72 9      10 0.1 3184 64 3.0926 40
10    110 .658727 0 1.34 862 3
> RF 1  < -ran do m For e st (tr a in[ ,c("stor eI d" ,"dat 1"," d a t 2 ")],  tr ain$ sales , do.trace=TR UE, 
+ i m por tance =TRUE ,ntr ee =5,,f orest= TRUE) 
    |      Out- of-b ag   |
Tr ee|   MSE % Var(y)  |  1 | 2.9 15e+05 54 4. 4 4 |   2 | 1.825e+05  3 4 0 .8 4 |
   3  |  2. 1 e+ 05   392.19  | 
  4 | 1 .914e +05 3 57.38 |   5 | 1. 80 9e+05  3 37.78|> p red  <- p r edic t(RF1,  test)
E rrori n predict.rand o mForest(RF1,t es t )  : 
  N ewfactor leve ls n o t pr esen t  i n t h e tra ining  d a ta 
This part makes se ns e.
SoI try  this:
> test 2 <- test[ t e s t$storeI d!=1 1, ] 
> pred <- pre dict( RF1, test2 ) 
Error i n pre dict.ran domForest ( R F1, test 2):   N ewf a ct or levels not p rese nt  in the  tr ainingdat a
SoI t ry  this:
>levels(t es t2 $s to reI d)
 [ 1 ] "2"  " 3"   " 4"   " 
 _936.2206 _   _ 7_0.2173074_4.835064
8 _244.6947_  _  _8 0.6526765 6.516790
9 _818.8747  __   9 0.3317644 9.651675
10 631.6104      10 0.6998037_8.443972
>_test 
___storeId    _ dat1   _ dat2
1_       2_0.7513645_3.442052
2  _     3 0.2862487 3.196189
3 _     _4 0.4971865 6.074281
4___   _ 5 0.8631945 8.766129
5  _     6_0.3848105 5.001426
6     _  7 0.9032262 7.018274
7 _    _ 8_0.1560501 4.523618
8   _  _ 9_0.3461597 5.551672
9 _     10_0.1318464 3.092640
10 _    11 0.6587270_1.348623

>_RF1 <- randomForest(train[,c("storeId","dat1","dat2")],_train$sales,_do.trace=TRUE,
+_importance=TRUE,ntree=5,,forest=TRUE)
 _  _|_ __  Out-of-bag   |
Tree_|_     MSE _%Var(y) |
  _1_| 2.915e+05  _544.44 |
   2_| 1.825e+05   340.84 |
_ _3 |_ 2.1e+05   392.19 |
   4 | 1.914e+05_  357.38 |
  _5 | 1.809e+05 _ 337.78_|
>_pred <- predict(RF1,_test)
Error_in predict.randomForest(RF1,_test) : 
  New factor levels_not present_in the training data

This part makes_sense.
So I try this:
>_test2_<- test[test$storeId!= 11,]
> pred <- predict(RF1,_test2)
Error in predict.randomForest(RF1, test2) : 
_ New factor levels not_present_in_the training data

So I try_this:
> levels(test2$storeId)
 [1] "2"  "3"_ "4" _"