<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Thank you very much Wilfried.<br>
    Best,<br>
    <br>
    Manuel<br>
    <br>
    <br>
    On 05/09/2010 11:37 p.m., Wilfried Thuiller wrote:
    <blockquote
      cite="mid:CB769A95-C57E-49CE-A3B1-8A809A8B7646@ujf-grenoble.fr"
      type="cite">
      <div>Yes, join will do more or less the same than xyValues.</div>
      <div>I think the xyValues is better as you can also select the
        type of sampling design (neighbor or bilinear interpolation).</div>
      <div><br>
      </div>
      <div>For Maxent asc files, this is easy to load:</div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div>Compare to what I wrote, it will look like:</div>
      <div><br>
      </div>
      <div>mn6190_ann =&nbsp;raster(mn6190_ann.asc)</div>
      <div>cld6190_ann&nbsp;=&nbsp;raster(cld6190_ann.asc)</div>
      <div>mydata = stack(mn6190_ann,&nbsp;cld6190_ann)</div>
      <div><br>
      </div>
      <div>myXYvariables = xyValues(CoordXY, mydata)</div>
      <div><br>
      </div>
      <div>## you can remove the stack part with a loop as I wrote below
        in my first email.&nbsp;</div>
      <div><br>
      </div>
      <div>Best</div>
      <div>Wilfried</div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div><br>
      </div>
      <br>
      <div>
        <div>Le 6 sept. 2010 &agrave; 01:06, Manuel Sp&iacute;nola a &eacute;crit :</div>
        <br class="Apple-interchange-newline">
        <blockquote type="cite">
          <div bgcolor="#ffffff" text="#000000"> Thank you very much
            Wilfried.<br>
            <br>
            Yes, I mean ASCII grids.<br>
            <br>
            For example, I have 2 files: "tmn6190_ann.asc" and
            "cld6190_ann.asc" (layers from MAXENT) but I want to bring
            them to BIOMOD.<br>
            <br>
            I found a function in the adehabitatMA package called "join"
            that I think does what I am looking for but it works only
            for an object of class "SpatialPixelsDataFrame" (package
            sp):<br>
            <br>
            df &lt;- join(locs, map) # "locs" are animal locations and
            "map" are environmental variables. <br>
            <br>
            The result is a data frame containing the value of the
            variables at the speci fied locations.<br>
            <br>
            Do you think the join function will do the same that you
            suggested me.<br>
            <br>
            Best,<br>
            <br>
            Manuel<br>
            <br>
            <br>
            On 05/09/2010 02:34 p.m., Wilfried Thuiller wrote:
            <blockquote
              cite="mid:573A46CD-4FB1-47BC-AC38-1A4F0555F2B8@ujf-grenoble.fr"
              type="cite">Hi Manuel,
              <div>What do you mean by ASCII files? Do you mean ASGII
                grids? (exprt asc from raster/grid). I guess your
                variables were on Arcgis or something like that and you
                exported them on ASCII files?&nbsp;</div>
              <div><br>
              </div>
              <div>If this right, this is rather easy.</div>
              <div>Make sure your species data (which I guess is a
                matrix with X and Y coordinates and then columns with
                presence-absence) and ASCII files use the same spatial
                projection.&nbsp;</div>
              <div>Then, load the rgdal and raster package</div>
              <div><br>
              </div>
              <div>then read the ASCII file (one by one) using the
                raster function of the raster package, then build a
                stack of raster, and then project the values of the
                variables onto the XY values of your sites.</div>
              <div>I give you below an example (with arcgis grid layers
                not ASCII but it works the same way).</div>
              <div><br>
              </div>
              <div>Hope it helps</div>
              <div><br>
              </div>
              <div>Wilfried</div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div>##### Load my XY data (European data with XY
                coordinates in column 2 and 3, and then species.&nbsp;</div>
              <div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(0, 113, 40);">library<span style="color: rgb(4,
                    34, 153);">(</span>foreign<span style="color: rgb(4,
                    34, 153);">)</span></div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(0, 113, 40);">AFE_PA_XY<span style="color: rgb(4,
                    34, 153);"> &lt;- </span>read.dbf<span
                    style="color: rgb(4, 34, 153);">(</span><span
                    style="color: rgb(176, 20, 12);">'AFE_PA_XY.dbf'</span><span
                    style="color: rgb(4, 34, 153);">)</span></div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(4, 34, 153); min-height: 15px;"><br>
                </div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(4, 34, 153); min-height: 15px;">### Create a
                  vector with the names of the variables I want to load
                  (here the worldclim data for instance)</div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(0, 113, 40);">bio<span style="color: rgb(4, 34,
                    153);"> &lt;- </span>paste<span style="color:
                    rgb(4, 34, 153);">(</span>rep<span style="color:
                    rgb(4, 34, 153);">(</span><span style="color:
                    rgb(176, 20, 12);">'bio'</span><span style="color:
                    rgb(4, 34, 153);">, </span>times<span style="color:
                    rgb(4, 34, 153);">=</span><span style="color:
                    rgb(43, 111, 184);">19</span><span style="color:
                    rgb(4, 34, 153);">), </span>seq<span style="color:
                    rgb(4, 34, 153);">(</span><span style="color:
                    rgb(43, 111, 184);">1</span><span style="color:
                    rgb(4, 34, 153);">:</span><span style="color:
                    rgb(43, 111, 184);">19</span><span style="color:
                    rgb(4, 34, 153);">), </span>sep<span style="color:
                    rgb(4, 34, 153);">=</span><span style="color:
                    rgb(176, 20, 12);">"_"</span><span style="color:
                    rgb(4, 34, 153);">)</span></div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(4, 34, 153); min-height: 15px;"><br>
                </div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(0, 113, 40);">library<span style="color: rgb(4,
                    34, 153);">(</span>raster<span style="color: rgb(4,
                    34, 153);">)</span></div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(0, 113, 40);"><span style="color: rgb(4, 34,
                    153);">### Create a loop to load sequentially the
                    raster (the first line in the loop) and then project
                    the value of the loaded raster onto the XY
                    coordinates of the original file and store directly
                    in the dataframe with the name of the loaded raster</span></div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(0, 113, 40);"><span style="color: rgb(4, 34,
                    153);">You can even add a third line to rm the
                    raster/ASCII layer if it is a large dataset,
                    something like: e</span>val(parse(text=paste("rm(<span
                    class="Apple-style-span" style="color: rgb(4, 34,
                    153); font-family: Monaco; font-size: 11px;"><span
                      class="Apple-style-span" style="color: rgb(0, 113,
                      40);">",i, ")"</span></span><span
                    class="Apple-style-span" style="color: rgb(4, 34,
                    153); font-family: Monaco; font-size: 11px;"><span
                      class="Apple-style-span" style="color: rgb(0, 113,
                      40); font-family: Monaco; font-size: 11px;"><span
                        style="color: rgb(4, 34, 153);">, sep="")))</span></span></span></div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(0, 113, 40);"><span class="Apple-style-span"
                    style="color: rgb(4, 34, 153); font-family: Monaco;
                    font-size: 11px;"><span class="Apple-style-span"
                      style="color: rgb(0, 113, 40); font-family:
                      Monaco; font-size: 11px;"><span style="color:
                        rgb(4, 34, 153);"></span></span></span><span
                    class="Apple-style-span" style="color: rgb(4, 34,
                    153); font-family: Monaco; font-size: 11px;"><span
                      class="Apple-style-span" style="color: rgb(0, 113,
                      40);">&nbsp;</span></span></div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(4, 34, 153);"><span style="color: rgb(219, 34,
                    74);">for</span>(<span style="color: rgb(0, 113,
                    40);">i</span> <span style="color: rgb(219, 34,
                    74);">in</span> <span style="color: rgb(0, 113,
                    40);">bio</span>)&nbsp;</div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(176, 20, 12);"><span style="color: rgb(4, 34,
                    153);"><span class="Apple-tab-span"
                      style="white-space: pre;"> </span></span><span
                    style="color: rgb(0, 113, 40);">eval</span><span
                    style="color: rgb(4, 34, 153);">(</span><span
                    style="color: rgb(0, 113, 40);">parse</span><span
                    style="color: rgb(4, 34, 153);">(</span><span
                    style="color: rgb(0, 113, 40);">text</span><span
                    style="color: rgb(4, 34, 153);">=</span><span
                    style="color: rgb(0, 113, 40);">paste</span><span
                    style="color: rgb(4, 34, 153);">(</span><span
                    style="color: rgb(0, 113, 40);">i</span><span
                    style="color: rgb(4, 34, 153);">, </span>"&lt;-
                  raster('/Volumes/GIS_Data/Global/Climate/Current/Wordclim/10m/bio/"<span
                    style="color: rgb(4, 34, 153);">, </span><span
                    style="color: rgb(0, 113, 40);">i</span><span
                    style="color: rgb(4, 34, 153);">,</span>"')"<span
                    style="color: rgb(4, 34, 153);">, </span><span
                    style="color: rgb(0, 113, 40);">sep</span><span
                    style="color: rgb(4, 34, 153);">=</span>""<span
                    style="color: rgb(4, 34, 153);">)))</span></div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(4, 34, 153); min-height: 15px;"><span
                    class="Apple-tab-span" style="white-space: pre;"> </span>eval(parse(text=paste("<span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40);">AFE_PA_XY$",i, "</span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40);">xyValues</span><span class="Apple-style-span"
                    style="color: rgb(0, 113, 40); font-family: Monaco;
                    font-size: 11px;"><span style="color: rgb(4, 34,
                      153);">(</span></span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;">worldclim</span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;"><span
                      style="color: rgb(4, 34, 153);">,&nbsp;</span></span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;">AFE_PA_XY</span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;"><span
                      style="color: rgb(4, 34, 153);">[,</span></span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;"><span
                      style="color: rgb(43, 111, 184);">2</span></span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;"><span
                      style="color: rgb(4, 34, 153);">:</span></span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;"><span
                      style="color: rgb(43, 111, 184);">3</span></span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;"><span
                      style="color: rgb(4, 34, 153);">],</span></span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;">method</span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;"><span
                      style="color: rgb(4, 34, 153);">=</span></span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;"><span
                      style="color: rgb(176, 20, 12);">'bilinear'</span></span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40); font-family: Monaco; font-size: 11px;"><span
                      style="color: rgb(4, 34, 153);">)", sep="")))</span></span><span
                    class="Apple-style-span" style="color: rgb(0, 113,
                    40);">&nbsp;&nbsp;</span></div>
                <div style="margin: 0px; font: 11px Monaco; color:
                  rgb(0, 113, 40);"><font class="Apple-style-span"
                    color="#042299" face="Helvetica"><span
                      class="Apple-style-span" style="font-size:
                      medium;"><font class="Apple-style-span" size="3"
                        color="#007128" face="Monaco"><span
                          class="Apple-style-span" style="font-size:
                          11px;"><br>
                        </span></font></span></font></div>
              </div>
              <div style="margin: 0px; font: 11px Monaco; color: rgb(0,
                113, 40);"><font class="Apple-style-span"
                  color="#042299" face="Helvetica"><span
                    class="Apple-style-span" style="font-size: medium;"><font
                      class="Apple-style-span" size="3" color="#007128"
                      face="Monaco"><span class="Apple-style-span"
                        style="font-size: 11px;"><br>
                      </span></font></span></font></div>
              <div style="margin: 0px; font: 11px Monaco; color: rgb(0,
                113, 40);"><font class="Apple-style-span"
                  color="#042299" face="Helvetica"><span
                    class="Apple-style-span" style="font-size: medium;"><font
                      class="Apple-style-span" size="3" color="#007128"
                      face="Monaco"><span class="Apple-style-span"
                        style="font-size: 11px;"><br>
                      </span></font></span></font></div>
              <div><br>
                <div>
                  <div>Le 5 sept. 2010 &agrave; 17:12, Manuel Sp&iacute;nola a &eacute;crit :</div>
                  <br class="Apple-interchange-newline">
                  <blockquote type="cite">
                    <div> Dear list members,<br>
                      <br>
                      I know this is a basic question and not completed
                      related to BIOMOD.<br>
                      I want to run an analysis using BIOMOD but I would
                      like to know the best way to bring bioclimatic and
                      land use variables from ASCII files to the format
                      that the environmental variables are presented in
                      the BIOMOD manual.<br>
                      Thank you very much in advance.<br>
                      Best,<br>
                      <br>
                      Manuel<br>
                      <br>
                      -- <br>
                      Manuel Sp&iacute;nola, Ph.D.<br>
                      Instituto Internacional en Conservaci&oacute;n y Manejo
                      de Vida Silvestre<br>
                      Universidad Nacional<br>
                      Apartado 1350-3000<br>
                      Heredia<br>
                      COSTA RICA<br>
                      <a moz-do-not-send="true"
                        href="mailto:mspinola@una.ac.cr">mspinola@una.ac.cr</a><br>
                      <a moz-do-not-send="true"
                        class="moz-txt-link-abbreviated"
                        href="mailto:mspinola10@gmail.com">mspinola10@gmail.com</a><br>
                      Tel&eacute;fono: (506) 2277-3598<br>
                      Fax: (506) 2237-7036<br>
                      <br>
                      _______________________________________________<br>
                      Biomod-commits mailing list<br>
                      <a moz-do-not-send="true"
                        class="moz-txt-link-abbreviated"
                        href="mailto:Biomod-commits@lists.r-forge.r-project.org">Biomod-commits@lists.r-forge.r-project.org</a><br>
                      <a moz-do-not-send="true"
                        class="moz-txt-link-freetext"
href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits</a><br>
                    </div>
                  </blockquote>
                </div>
                <br>
                <div>
                  <div style="word-wrap: break-word;"><span
                      class="Apple-style-span" style="border-collapse:
                      separate; 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;">
                      <div style="word-wrap: break-word;">
                        <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&eacute; 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:&nbsp;<a moz-do-not-send="true"
                                href="mailto:wilfried.thuiller@ujf-grenoble.fr">wilfried.thuiller@ujf-grenoble.fr</a><br>
                              Home page:&nbsp;<a moz-do-not-send="true"
                                href="http://www.will.chez-alice.fr/">http://www.will.chez-alice.fr</a><br>
                              Website:&nbsp;<a moz-do-not-send="true"
                                href="http://www-leca.ujf-grenoble.fr/equipes/tde.htm">http://www-leca.ujf-grenoble.fr/equipes/tde.htm</a><br>
                              <br>
                              FP6 European MACIS project:&nbsp;<a
                                moz-do-not-send="true"
                                href="http://www.macis-project.net/">http://www.macis-project.net</a><br>
                              FP6 European EcoChange project:&nbsp;<a
                                moz-do-not-send="true"
                                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>
                  <br class="Apple-interchange-newline">
                  <br class="Apple-interchange-newline">
                </div>
                <br>
              </div>
            </blockquote>
            <br>
            <br>
            <pre class="moz-signature" cols="72">-- 
Manuel Sp&iacute;nola, Ph.D.
Instituto Internacional en Conservaci&oacute;n y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:mspinola@una.ac.cr">mspinola@una.ac.cr</a>
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:mspinola10@gmail.com">mspinola10@gmail.com</a>
Tel&eacute;fono: (506) 2277-3598
Fax: (506) 2237-7036</pre>
          </div>
        </blockquote>
      </div>
      <br>
      <div>
        <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;"><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;">
            <div style="word-wrap: break-word;"><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;">
                <div style="word-wrap: break-word;">
                  <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&eacute; 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:&nbsp;<a moz-do-not-send="true"
                          href="mailto:wilfried.thuiller@ujf-grenoble.fr">wilfried.thuiller@ujf-grenoble.fr</a><br>
                        Home page:&nbsp;<a moz-do-not-send="true"
                          href="http://www.will.chez-alice.fr/">http://www.will.chez-alice.fr</a><br>
                        Website:&nbsp;<a moz-do-not-send="true"
                          href="http://www-leca.ujf-grenoble.fr/equipes/tde.htm">http://www-leca.ujf-grenoble.fr/equipes/tde.htm</a><br>
                        <br>
                        FP6 European MACIS project:&nbsp;<a
                          moz-do-not-send="true"
                          href="http://www.macis-project.net/">http://www.macis-project.net</a><br>
                        FP6 European EcoChange project:&nbsp;<a
                          moz-do-not-send="true"
                          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">
        </span><br class="Apple-interchange-newline">
      </div>
      <br>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Manuel Sp&iacute;nola, Ph.D.
Instituto Internacional en Conservaci&oacute;n y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
<a class="moz-txt-link-abbreviated" href="mailto:mspinola@una.ac.cr">mspinola@una.ac.cr</a>
<a class="moz-txt-link-abbreviated" href="mailto:mspinola10@gmail.com">mspinola10@gmail.com</a>
Tel&eacute;fono: (506) 2277-3598
Fax: (506) 2237-7036</pre>
  </body>
</html>