<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Dear Jason,</div><div><br></div><div>This is indeed surprising. </div><div><br></div><div>I am bit surprised with the following code </div><div><br></div>files <- list.files("~/Documents/R/R_data/SD/raster/current", pattern='asc', full.names=T)<br>CurrentStack <- stack(files[c(1,13,14,15,4,6,7,20)])<br><br><div>Are you sure it works fine? </div><div>Try to make a plot of CurrentStack and print the summary of the rasters. I am surprised you manage to stack these files whereas you do not give the pass to stack. </div><div><br></div><div>In any case, it seems that CurrentStack data are not in the good format. </div><div><br></div><div>Best</div><div>Wilfried</div><div><br></div><div><br></div><div><br><div><div>Le 8 févr. 2012 à 02:03, jason b mackenzie a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>All</div><div><br></div><div><br></div><div>I am getting an error (below) using the Projection.raster function. </div><div><br></div><div><i>Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) : </i></div><div><div><i>  invalid type (list) for variable 'DataF'</i></div><div><i>In addition: Warning message:</i></div><div><i>'newdata' had 5711 rows but variable(s) found have 1131 rows</i></div></div><div><br></div><div><br></div><div><br></div><div>I thought part of the problem might relate to differences in the naming of my explanatory variables, but they appear to be the same in both my presence-absence site data (='SP.ENV') and my RasterStack (='CurrentStack').</div><div><i><br></i></div><div><i>> colnames(SP.ENV[,4:11])</i></div><div><div><div><i>[1] "bio_1"      "bio_3"      "bio_4"      "bio_5"      "bio_12"     "bio_14"     "bio_15"     "soil_aws"</i></div></div></div><div><div><i>> layerNames(CurrentStack)</i></div><div><i>[1] "bio_1"      "bio_3"      "bio_4"      "bio_5"      "bio_12"     "bio_14"     "bio_15"     "soil_aws"</i></div></div><div><br></div><div><br></div><div><br></div><div>Also, the row flags noted in the warning message don't correspond with dimensions of either dataset?</div><div><i><br></i></div><div><i>> dim(SP.ENV)</i></div><div><div><i>[1] 1742   75</i></div><div><i>> dim(CurrentStack)</i></div><div><i>[1] 232 238   8</i></div></div><div><br></div><div><br></div><div><br></div><div>Any suggestions? FYI, I am running the latest versions of R (2.14.1) and BIOMOD (1.1.7) and my calls are pasted below.</div><div><br></div><div><br></div><div><br></div><div>Cheers, </div><div>Jason</div><div><br></div><div><br></div><div>-- <br><br><b>Jason MacKenzie, PhD</b><br><i>Senior Conservation Fellow</i><br>The Nature Conservancy<br>201 Mission Street, 4th Floor<br>San Francisco, CA 94105<br><a href="mailto:jmackenzie@tnc.org" target="_blank">jmackenzie@tnc.org</a><i><br></i>jasonbmackenzie        [skype]</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; color: rgb(12, 32, 153); "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; color: rgb(12, 32, 153); ">library(<span style="color: #000000">raster</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; color: rgb(12, 32, 153); ">library(<span style="color: #000000">BIOMOD</span>)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; color: rgb(176, 20, 9); "><span style="color: #0c2099">setwd(</span>"~/Documents/R/R_data/SD/veg4"<span style="color: #0c2099">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; color: rgb(176, 20, 9); "><span style="color: #000000">SP.ENV </span><span style="color: #0c2099"><-</span><span style="color: #000000"> </span><span style="color: #0c2099">read.table(</span>"SPENV_veg4.txt"<span style="color: #0c2099">,</span><span style="color: #000000">  h</span><span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span><span style="color: #000000"> sep</span><span style="color: #0c2099">=</span>"\t"<span style="color: #0c2099">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; color: rgb(176, 20, 9); "><span style="color: #000000">COORxy </span><span style="color: #0c2099"><-</span><span style="color: #000000"> </span><span style="color: #0c2099">read.table(</span>"CoorXY_veg4.txt"<span style="color: #0c2099">,</span><span style="color: #000000"> h</span><span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span><span style="color: #000000"> sep</span><span style="color: #0c2099">=</span>"\t"<span style="color: #0c2099">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; "><span style="color: #0c2099">Initial.State(</span>Response<span style="color: #0c2099">=</span>SP.ENV<span style="color: #0c2099">[,</span><span style="color: #055219">12</span><span style="color: #0c2099">:</span><span style="color: #055219">13</span><span style="color: #0c2099">],</span> Explanatory<span style="color: #0c2099">=</span>SP.ENV<span style="color: #0c2099">[,</span><span style="color: #055219">4</span><span style="color: #0c2099">:</span><span style="color: #055219">11</span><span style="color: #0c2099">],</span> IndependentResponse<span style="color: #0c2099">=</span><span style="color: #c3892b">NULL</span><span style="color: #0c2099">,</span> IndependentExplanatory<span style="color: #0c2099">=</span><span style="color: #c3892b">NULL</span><span style="color: #0c2099">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; min-height: 16px; "><span class="Apple-tab-span" style="white-space:pre">                                       </span><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; "><span style="color: #0c2099">Models(</span>GLM<span style="color: #0c2099">=</span><span style="color: #c3892b">F</span><span style="color: #0c2099">,</span> TypeGLM<span style="color: #0c2099">=</span><span style="color: #b01409">"quad"</span><span style="color: #0c2099">,</span> Test<span style="color: #0c2099">=</span><span style="color: #b01409">"AIC"</span><span style="color: #0c2099">,</span> GAM<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> Spline<span style="color: #0c2099">=</span><span style="color: #055219">4</span><span style="color: #0c2099">,</span> GBM<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> No.trees<span style="color: #0c2099">=</span><span style="color: #055219">3000</span><span style="color: #0c2099">,</span> CTA<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> CV.tree<span style="color: #0c2099">=</span><span style="color: #055219">50</span><span style="color: #0c2099">,</span> ANN<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> CV.ann<span style="color: #0c2099">=</span><span style="color: #055219">3</span><span style="color: #0c2099">,</span> SRE<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> quant<span style="color: #0c2099">=</span><span style="color: #055219">0.025</span><span style="color: #0c2099">,</span> FDA<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> MARS<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> RF<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> NbRunEval<span style="color: #0c2099">=</span><span style="color: #055219">3</span><span style="color: #0c2099">,</span> DataSplit<span style="color: #0c2099">=</span><span style="color: #055219">70</span><span style="color: #0c2099">,</span> Yweights<span style="color: #0c2099">=</span><span style="color: #c3892b">NULL</span><span style="color: #0c2099">,</span> Roc<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> Optimized.Threshold.Roc<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> Kappa<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> TSS<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> KeepPredIndependent<span style="color: #0c2099">=</span><span style="color: #c3892b">F</span><span style="color: #0c2099">,</span> VarImport<span style="color: #0c2099">=</span><span style="color: #055219">5</span><span style="color: #0c2099">,</span> NbRepPA<span style="color: #0c2099">=</span><span style="color: #055219">2</span><span style="color: #0c2099">,</span> strategy<span style="color: #0c2099">=</span><span style="color: #b01409">"sre"</span><span style="color: #0c2099">,</span> nb.absences<span style="color: #0c2099">=</span><span style="color: #055219">1000</span><span style="color: #0c2099">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; "><span style="color: #0c2099">CurrentPred(</span>GLM<span style="color: #0c2099">=</span><span style="color: #c3892b">F</span><span style="color: #0c2099">,</span> GAM<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> GBM<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> CTA<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> ANN<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> SRE<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> FDA<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> MARS<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> RF<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> BinRoc<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span>  BinKappa<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span>  BinTSS<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> FiltRoc<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> FiltKappa<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> FiltTSS<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">)</span> </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; min-height: 16px; "><span class="Apple-tab-span" style="white-space:pre">                                                            </span><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; "><span style="color: #0c2099">PredictionBestModel(</span>method<span style="color: #0c2099">=</span><span style="color: #b01409">'all'</span><span style="color: #0c2099">,</span> Bin.trans<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> Filt.trans<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">)</span><span class="Apple-tab-span" style="white-space:pre"> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; min-height: 16px; "><span class="Apple-tab-span" style="white-space:pre">            </span><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; color: rgb(176, 20, 9); "><span style="color: #000000">files </span><span style="color: #0c2099"><-</span><span style="color: #000000"> </span><span style="color: #0c2099">list.files(</span>"~/Documents/R/R_data/SD/raster/current"<span style="color: #0c2099">,</span><span style="color: #000000"> pattern</span><span style="color: #0c2099">=</span>'asc'<span style="color: #0c2099">,</span><span style="color: #000000"> full.names</span><span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">)</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; color: rgb(12, 32, 153); "><span style="color: #000000">CurrentStack </span><-<span style="color: #000000"> </span>stack(<span style="color: #000000">files</span>[c(<span style="color: #055219">1</span>,<span style="color: #055219">13</span>,<span style="color: #055219">14</span>,<span style="color: #055219">15</span>,<span style="color: #055219">4</span>,<span style="color: #055219">6</span>,<span style="color: #055219">7</span>,<span style="color: #055219">20</span>)])</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; min-height: 16px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; "><span style="color: #0c2099">Projection.raster(</span>RasterProj <span style="color: #0c2099">=</span> CurrentStack<span style="color: #0c2099">,</span> <a href="http://Proj.name/">Proj.name</a><span style="color: #0c2099">=</span><span style="color: #b01409">'CurrentRaster'</span><span style="color: #0c2099">,</span> GLM<span style="color: #0c2099">=</span><span style="color: #c3892b">F</span><span style="color: #0c2099">,</span> GAM<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> GBM<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> CTA<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> ANN<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> SRE<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> quant<span style="color: #0c2099">=</span><span style="color: #055219">0.025</span><span style="color: #0c2099">,</span> FDA<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> MARS<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> RF<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> BinRoc<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> BinKappa<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> BinTSS<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> FiltRoc<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> FiltKappa<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> FiltTSS<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> repetition.model<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> stack.out<span style="color: #0c2099">=</span><span style="color: #c3892b">T</span><span style="color: #0c2099">,</span> compress<span style="color: #0c2099">=</span><span style="color: #b01409">"gzip"</span><span style="color: #0c2099">)</span></div></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 4px; text-indent: -4px; font: normal normal normal 12px/normal Monaco; "><span style="color: #0c2099"><br></span></div><div><br></div>
<br></div>_______________________________________________<br>Biomod-commits mailing list<br><a href="mailto:Biomod-commits@lists.r-forge.r-project.org">Biomod-commits@lists.r-forge.r-project.org</a><br>https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits</blockquote></div><br><div apple-content-edited="true">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="font-size: 12px; "><div>--------------------------</div><div>Dr. Wilfried Thuiller</div><div>Laboratoire d'Ecologie Alpine, UMR CNRS 5553</div><div>Université Joseph Fourier</div><div>BP53, 38041 Grenoble cedex 9, France</div><div>tel: +33 (0)4 76 51 44 97</div><div>fax: +33 (0)4 76 51 42 79</div><div><br></div><div>Email: <a href="mailto:wilfried.thuiller@ujf-grenoble.fr">wilfried.thuiller@ujf-grenoble.fr</a><br>Personal website: <a href="http://www.will.chez-alice.fr/">http://www.will.chez-alice.fr</a><br>Team website: <a href="http://www-leca.ujf-grenoble.fr/equipes/emabio.htm">http://www-leca.ujf-grenoble.fr/equipes/emabio.htm</a><br><br>ERC Starting Grant TEEMBIO project: <a href="http://www.will.chez-alice.fr/Research.html">http://www.will.chez-alice.fr/Research.html</a><br>FP6 European EcoChange project: <a href="http://www.ecochange-project.eu/">http://www.ecochange-project.eu</a></div><div><br></div></span></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></div></body></html>