Dear Listers,

I have a list (list.of.files) of file names (character vector) with n number
of elements.

List of 9
 $ 1: chr [1:5] "binned_walker1_1.grd" ...
 $ 2: chr [1:2] "binned_walker2_1.grd" ...
 $ 3: chr [1:3] "binned_walker3_1.grd" ...
 $ 4: chr [1:6] "binned_walker4_1.grd" ...
 $ 5: chr "binned_walker5_1.grd" ...
 $ 6: chr [1:4] "binned_walker6_1.grd" ...
 $ 7: chr [1:6] "binned_walker7_1.grd" ...
 $ 8: chr [1:4] "binned_walker8_1.grd" ...
 $ 9: chr [1:3] "binned_walker9_1.grd" ...

If I call stack() on list elements using, for example

stack(list.of.files[[1]])

I get a RasterStack object with appropriate number of layers.

If I call lapply on list.of.files with

lapply(list.of.files, FUN = function(x) stack(x))

I get an error

$`1`
Error in print(<S4 object of class "RasterStack">) :
  no slot of name "file" for this object of class "RasterStack"

Can anyone elucidate why the method works "by hand" and not using lapply?

Cheers,
Roman



-- 
In God we trust, all others bring data.

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to