[R-sig-Geo] Decision tree classification of satellite image in R

Anusheema Chakraborty anusheema at gmail.com
Tue May 6 08:37:25 CEST 2014


Hi!

I am trying to classify satellite image in R using RWeka classifier,
J48. I have a CSV file with the classes required, and raster data
loaded in R. I am able to make the tree, however, I am not able to use
the same tree to classify my satellite image.

Here's how it goes.

inputfile=read.csv("E://R/Trial/naini.CSV")
m1 <- J48(Class~B1+B2+B3+B4+B5+B7, data = inputfile)
if(require("party", quietly = TRUE)) plot(m1)
raster<- brick("merge.tif")
plotRGB(raster, 4, 3, 2, stretch="hist")

And then I am attempting to use the tree generated to classify my
satellite image, but I keep getting errors.

predict (test_new, J48, filename=out_classify,
progress='text',format='GTiff', datatype='FLT4S', type='response',
overwrite=TRUE)
Error in trim(filename) : error in evaluating the argument 'x' in
selecting a method for function 'trim': Error: object 'out_classify'
not found

And if I change the arguments, this is what I get. I am not sure how
to proceed from this point forward.

predict (J48, test_new, filename=out_classify,
progress='text',format='GTiff', datatype='FLT4S', type='response',
overwrite=TRUE)
Error in UseMethod("predict") : no applicable method for 'predict'
applied to an object of class "c('R_Weka_classifier_interface',
'R_Weka_interface')"

I am new to R, so I might take a while to decipher your answers. Any
help would be greatly appreciated!

Thanks!


Best,
Anusheema.



-- 
Regards

Anusheema Chakraborty
Ph.D. Scholar
Department of Natural Resources, TERI University
10, Institutional Area, Vasant Kunj, New Delhi - 110070
Website: www.teriuniversity.ac.in



More information about the R-sig-Geo mailing list