<div dir="ltr"><div><div>Martin,<br></div>I have replaced brick() with stack() and still got the error when I run the line data. Here is how it looks now:<br><br><span style="color:rgb(0,0,255)">install.packages("RStoolbox")<br>install.packages(raster)<br><br>library(ggplot2)<br>library(raster)<br>library(rgdal)<br><br>bs3 <- raster("C:/R_examples/VI/B3.TIF")<br>bs4 <- raster("C:/R_examples/VI/B4.TIF")<br><br>bs3<br>bs4<br><br>group <- stack(bs3, bs4)<br><br>#writeRaster(group, filename = "C:/R_examples/VI/grupa.TIF")<br><br>data(group)<br><br>## Calculate NDVI <br><br>ndvi <- spectralIndices(group, red = "bs3", nir = "bs4", indices = "NDVI")<br><br>ndvi<br><br></span></div><span style="color:rgb(0,0,255)">eror when I run line </span><span style="color:rgb(0,0,255)">data(group)<br><br></span><pre tabindex="0" class="gmail-GODMDAHBLOB" id="gmail-rstudio_console_output" style="font-family:"lucida console";font-size:10pt;outline:medium none;border-width:medium;border-style:none;border-color:-moz-use-text-color;word-break:break-all;margin:0px;white-space:pre-wrap;line-height:15px;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)"><span class="gmail-GODMDAHBFOB gmail-ace_constant" style="color:rgb(197,6,11)">Warning message:
</span><span class="gmail-GODMDAHBFOB gmail-ace_constant" style="color:rgb(197,6,11)">In data(group) :</span><span class="gmail-GODMDAHBFOB gmail-ace_constant" style="color:rgb(197,6,11)"> data set ‘group’ not found</span></pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 12, 2016 at 8:17 AM, Martin Wegmann <span dir="ltr"><<a href="mailto:martin.wegmann@uni-wuerzburg.de" target="_blank">martin.wegmann@uni-wuerzburg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="background-color:rgb(255,255,255);line-height:initial" lang="en-GB">                                                                                      <div style="width:100%;font-size:initial;font-family:Calibri,'Slate Pro',sans-serif,sans-serif;color:rgb(31,73,125);text-align:initial;background-color:rgb(255,255,255)">Dear Dragan,</div><div style="width:100%;font-size:initial;font-family:Calibri,'Slate Pro',sans-serif,sans-serif;color:rgb(31,73,125);text-align:initial;background-color:rgb(255,255,255)"><br></div><div style="width:100%;font-size:initial;font-family:Calibri,'Slate Pro',sans-serif,sans-serif;color:rgb(31,73,125);text-align:initial;background-color:rgb(255,255,255)">Please replace brick() with stack() and it should work, and of course you need to adapt your band names in spectralIndices()‎.</div><div style="width:100%;font-size:initial;font-family:Calibri,'Slate Pro',sans-serif,sans-serif;color:rgb(31,73,125);text-align:initial;background-color:rgb(255,255,255)"><br></div><div style="width:100%;font-size:initial;font-family:Calibri,'Slate Pro',sans-serif,sans-serif;color:rgb(31,73,125);text-align:initial;background-color:rgb(255,255,255)">Regards, Martin</div>                                                                                                                                     <div style="width:100%;font-size:initial;font-family:Calibri,'Slate Pro',sans-serif,sans-serif;color:rgb(31,73,125);text-align:initial;background-color:rgb(255,255,255)"><br style="display:initial"></div>                                                                                                                                                                                                   <div style="font-size:initial;font-family:Calibri,'Slate Pro',sans-serif,sans-serif;color:rgb(31,73,125);text-align:initial;background-color:rgb(255,255,255)"></div>                                                                                                                                                                                  <table style="background-color:white;border-spacing:0px" width="100%"> <tbody><tr><td colspan="2" style="font-size:initial;text-align:initial;background-color:rgb(255,255,255)">                           <div style="border-style:solid none none;border-top-color:rgb(181,196,223);border-top-width:1pt;padding:3pt 0in 0in;font-family:Tahoma,'BB Alpha Sans','Slate Pro';font-size:10pt">  <div><b>From: </b>Dragan Kaludjerovic</div><div><b>Sent: </b>Sunday, December 11, 2016 23:21</div><div><b>To: </b><a href="mailto:rs-ecology@lists.uni-wuerzburg.de" target="_blank">rs-ecology@lists.uni-<wbr>wuerzburg.de</a></div><div><b>Subject: </b>Re: [RS-ecology] RS-ecology Digest, Vol 16, Issue 1</div></div></td></tr></tbody></table><div><div class="h5"><div style="border-style:solid none none;border-top-color:rgb(186,188,209);border-top-width:1pt;font-size:initial;text-align:initial;background-color:rgb(255,255,255)"></div><br><div id="m_3514289799792061681_originalContent"><div dir="ltr"><div>Now I have changed it, but still getting error<br><br><span style="color:rgb(0,0,255)">install.packages("RStoolbox")<br>install.packages(raster)<br><br>library(ggplot2)<br>library(raster)<br>library(rgdal)<br><br>bs3 <- raster("C:/R_examples/VI/B3.<wbr>TIF")<br>bs4 <- raster("C:/R_examples/VI/B4.<wbr>TIF")<br><br>bs3<br>bs4<br><br>group <- brick(bs3, bs4)<br><br>data(group)<br><br>## Calculate NDVI <br><br>ndvi <- spectralIndices(group, red = "bs3", nir = "bs4", indices = "NDVI")<br><br>ndvi<br><br></span></div>error is:<span style="color:rgb(0,0,255)"><br><br></span><br><pre class="m_3514289799792061681gmail-GODMDAHBLOB" id="m_3514289799792061681gmail-rstudio_console_output" style="font-family:"lucida console";font-size:10pt;outline:medium none;border-width:medium;border-style:none;border-color:-moz-use-text-color;word-break:break-all;margin:0px;white-space:pre-wrap;line-height:15px;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(255,255,255)"><span class="m_3514289799792061681gmail-GODMDAHBBPB m_3514289799792061681gmail-ace_keyword" style="color:blue;white-space:pre-wrap">> </span><span class="m_3514289799792061681gmail-GODMDAHBBOB m_3514289799792061681gmail-ace_keyword" style="color:blue">group <- brick(bs3, bs4)
</span><span class="m_3514289799792061681gmail-GODMDAHBBPB m_3514289799792061681gmail-ace_keyword" style="color:blue;white-space:pre-wrap">> </span><span class="m_3514289799792061681gmail-GODMDAHBBOB m_3514289799792061681gmail-ace_keyword" style="color:blue">data(group)
</span><span class="m_3514289799792061681gmail-GODMDAHBFOB m_3514289799792061681gmail-ace_constant" style="color:rgb(197,6,11)">Warning message:
</span><span class="m_3514289799792061681gmail-GODMDAHBFOB m_3514289799792061681gmail-ace_constant" style="color:rgb(197,6,11)">In data(group) :</span><span class="m_3514289799792061681gmail-GODMDAHBFOB m_3514289799792061681gmail-ace_constant" style="color:rgb(197,6,11)"> data set ‘group’ not found</span></pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 11, 2016 at 12:00 PM,  <span dir="ltr"><<a href="mailto:rs-ecology-request@lists.uni-wuerzburg.de" target="_blank">rs-ecology-request@lists.uni-<wbr>wuerzburg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send RS-ecology mailing list submissions to<br>
        <a href="mailto:rs-ecology@lists.uni-wuerzburg.de" target="_blank">rs-ecology@lists.uni-wuerzburg<wbr>.de</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.uni-wuerzburg.de/mailman/listinfo/rs-ecology" rel="noreferrer" target="_blank">https://lists.uni-wuerzburg.de<wbr>/mailman/listinfo/rs-ecology</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:rs-ecology-request@lists.uni-wuerzburg.de" target="_blank">rs-ecology-request@lists.uni-w<wbr>uerzburg.de</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:rs-ecology-owner@lists.uni-wuerzburg.de" target="_blank">rs-ecology-owner@lists.uni-wue<wbr>rzburg.de</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of RS-ecology digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. problem with RStoolbox (Dragan Kaludjerovic)<br>
   2. Re: problem with RStoolbox (Martin Wegmann)<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
Message: 1<br>
Date: Sat, 10 Dec 2016 19:00:11 +0100<br>
From: Dragan Kaludjerovic <<a href="mailto:advancedgwt@gmail.com" target="_blank">advancedgwt@gmail.com</a>><br>
To: <a href="mailto:RS-ecology@lists.uni-wuerzburg.de" target="_blank">RS-ecology@lists.uni-wuerzburg<wbr>.de</a><br>
Subject: [RS-ecology] problem with RStoolbox<br>
Message-ID:<br>
        <<a href="mailto:CAFZvhLipaCHuq-hQsk_5i31ThbCXGQZ4cPhP87%2BYS4P6__rzDw@mail.gmail.com" target="_blank">CAFZvhLipaCHuq-hQsk_5i31ThbCX<wbr>GQZ4cPhP87+YS4P6__rzDw@mail.<wbr>gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi,<br>
I have just discover RStoolbox and try simple simple script<br>
<br>
install.packages("RStoolbox")<br>
install.packages(raster)<br>
<br>
library(ggplot2)<br>
library(raster)<br>
library(rgdal)<br>
<br>
data(img)<br>
<br>
## Calculate NDVI<br>
ndvi <- spectralIndices(img, red = "C:/R_examples/VI/B3.tif", nir =<br>
"C:/R_examples/VI/B4.tif", indices = "NDVI")<br>
ndvi<br>
<br>
<br>
when I run it I got error message<br>
<br>
Error in match(xi, names(img)) : object 'img' not found<br>
<br>
Any suggestion is welcomed!<br>
<br>
Best Regards,<br>
<br>
Dragan<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.uni-wuerzburg.de/pipermail/rs-ecology/attachments/20161210/0a7d11e2/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.uni-wuerzburg.de<wbr>/pipermail/rs-ecology/attachme<wbr>nts/20161210/0a7d11e2/attachme<wbr>nt-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Sun, 11 Dec 2016 09:46:02 +0100<br>
From: Martin Wegmann <<a href="mailto:martin.wegmann@uni-wuerzburg.de" target="_blank">martin.wegmann@uni-wuerzburg.<wbr>de</a>><br>
To: Dragan Kaludjerovic <<a href="mailto:advancedgwt@gmail.com" target="_blank">advancedgwt@gmail.com</a>>,<br>
        <a href="mailto:RS-ecology@lists.uni-wuerzburg.de" target="_blank">RS-ecology@lists.uni-wuerzburg<wbr>.de</a><br>
Subject: Re: [RS-ecology] problem with RStoolbox<br>
Message-ID: <<a href="mailto:20161211084602.5943378.73264.3393@uni-wuerzburg.de" target="_blank">20161211084602.5943378.73264.<wbr>3393@uni-wuerzburg.de</a>><br>
Content-Type: text/plain; charset="us-ascii"<br>
<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.uni-wuerzburg.de/pipermail/rs-ecology/attachments/20161211/c04e82de/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.uni-wuerzburg.de<wbr>/pipermail/rs-ecology/attachme<wbr>nts/20161211/c04e82de/attachme<wbr>nt-0001.html</a>><br>
<br>
------------------------------<br>
<br>
______________________________<wbr>_________________<br>
RS-ecology mailing list<br>
<a href="mailto:RS-ecology@lists.uni-wuerzburg.de" target="_blank">RS-ecology@lists.uni-wuerzburg<wbr>.de</a><br>
<a href="https://lists.uni-wuerzburg.de/mailman/listinfo/rs-ecology" rel="noreferrer" target="_blank">https://lists.uni-wuerzburg.de<wbr>/mailman/listinfo/rs-ecology</a><br>
<br>
<br>
End of RS-ecology Digest, Vol 16, Issue 1<br>
******************************<wbr>***********<br>
</blockquote></div><br></div>
<br></div></div></div></div>
</blockquote></div><br></div>