0
votes

I have a rasterbrick that was generated using the dismo R package:

biovars(prec,tmax,tmin)
#> class       : RasterBrick 
#> dimensions  : 621, 1405, 872505, 19  (nrow, ncol, ncell, nlayers)
#> resolution  : 0.04166667, 0.04166667  (x, y)
#> extent      : -125.0208, -66.47917, 24.0625, 49.9375  (xmin, xmax, ymin, ymax)
#> coord. ref. : NA 
#> data source : in memory
#> names       :          bio1,          bio2,          bio3,          bio4,          #> bio5,          bio6,          bio7,          bio8,          bio9,         #> bio10,         bio11,         bio12,         bio13,         bio14,         bio15, ... 
#> min values  :     -5.877542,    -22.975250,            -?,    128.791868,     #> -4.569000,    -13.221000,     -6.819000,    -11.703167,    -15.058666,      1.778000,    -15.058666,     31.000000,      6.000000,      0.000000,      4.860504, ... 
#> max values  :  2.546279e+01, -2.974167e+00,  1.828863e+06,  1.357540e+03,  3.081900e+01,  2.528200e+01,  2.591300e+01,  3.418683e+01,  3.568500e+01,  3.697417e+01,  2.146250e+01,  6.317000e+03,  1.146000e+03,  1.440000e+02,  1.295139e+02, ... 

I want to save the 19 layers contained in the rasterbrick as individual .asc files.

I have tried writeRaster(brick, filename="bio.asc", format="ascii", bylayer=TRUE), but end up with the following error:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘writeRaster’ for signature ‘"standardGeneric", "character"’

1

1 Answers

1
votes

i may be wrong, but from the error mesasge it seems to me you are passing a wrong variable to writeraster (i.e., not a raster, rasterstack or rasterbrick)