I have a tiff file having 3 bands R, G, B. I used the following program in R to obtain the pixel values for each band separately.
r<- raster("lena.tiff", band = 1) writeRaster(r, filename = "lenadd.asc", format = "ascii", datatype= 'INT4U')
It gave me an ascii file containing the pixel values for R band. Similarly, by changing the band value to 2 and 3, I can get the other two files. However, I want to export the data in excel format. But I suppose, writeRaster command doesn't support xlsx format. So, can someone please suggest me any alternative of writeRaster command so that I can export my RGB data in excel format?
I am new to R so pardon me if the question is too trivial.
class : RasterLayer
band : 1 (of 3 bands)
dimensions : 512, 512, 262144 (nrow, ncol, ncell)
resolution : 1, 1 (x, y)
extent : 0, 512, 0, 512 (xmin, xmax, ymin, ymax)
coord. ref. : NA
data source : C:\Users\lenovo\Documents\lena.tiff
names : lena
values : 0, 255 (min, max)