Random forest script - problems with training areas polygon?
Silvia, you say that the areas of the shapefile are smaller. Do they intersect pixels centroids? The help of function 'extract' says the following (which might be relevant for your case?): If y represents polygons, the extract method returns the values of the cells of a Raster* object that are covered by a polygon. A cell is covered if its center is inside the polygon (but see the weights option for considering partly covered cells; and argument small for getting values for small polygons anyway). Cheers Hugo Roman Lu?trik <roman.lustrik at gmail.com> escreveu no dia quarta, 7/11/2018 ?(s) 15:03:
Can you make a reproducible example (data, scripts)? Have you tried debugging your code? Cheers, Roman On Wed, Nov 7, 2018 at 2:36 PM Silvia Flaherty <silvia.flaherty at gmail.com> wrote:
Hi all, I have been working with the random forest R script and have had no problems at all up to now. I recently modified the training areas shapefile. It?s actually an edited version of the original shapefile (which worked just fine). Same projection, etc, only the areas are smaller and more specific. That's the only input I changes. The script reads the shapefile but it doesn't do
the
classification. The error I get is: Error in `[.data.frame`(satValues, , 2) : undefined columns selected Checking line by line, he problem seems to be (line 139 of the loop): satValues <- extract(satImage, class_data[i,], cellnumbers=TRUE, df=TRUE) I?m not very skilled at using R but I?m quite OK with GIS. I have tried editing the shapefile again, saving it as another file, etc. Same result. Any ideas what could be going wrong? Thanks! Silvia <
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Libre de virus. www.avast.com <
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
<#m_542342069031620777_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
In God we trust, all others bring data.
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo