Displaying 4 results from an estimated 4 matches for "allrasters".
2024 Apr 18
1
Import multiple tif raster
? Thu, 18 Apr 2024 11:08:33 +0200
SIBYLLE ST?CKLI via R-help <r-help at r-project.org> ?????:
> > #to check the index numbers of all imported raster list elements
> > allrasters
> list()
> >
> > #call single raster element
> > allrasters[[1]]
> Error in allrasters[[1]] : subscript out of bounds
`allrasters` is an empty list, so it doesn't have a first item.
Therefore, allrasters[[1]] is an error. Why is this so? Probably
because list.files...
2024 Apr 18
1
Import multiple tif raster
...help <r-help at r-project.org>
Cc: sibylle.stoeckli at gmx.ch
Subject: Re: [R] Import multiple tif raster
? Thu, 18 Apr 2024 11:08:33 +0200
SIBYLLE ST?CKLI via R-help <r-help at r-project.org> ?????:
> > #to check the index numbers of all imported raster list elements
> > allrasters
> list()
> >
> > #call single raster element
> > allrasters[[1]]
> Error in allrasters[[1]] : subscript out of bounds
`allrasters` is an empty list, so it doesn't have a first item.
Therefore, allrasters[[1]] is an error. Why is this so? Probably because list.files(......
2024 Apr 18
1
Import multiple tif raster
...p"
>
> #first import all files in a single folder as a list
> rastlist <- list.files(path =
"/NCCS_Impacts_Lot2_2022/InVEST/Species_Input/bee_presence",
pattern='.tif$', all.files= T, full.names= T)
>
> #import all raster files in folder using lapply
> allrasters <- lapply(rastlist, raster)
>
> #to check the index numbers of all imported raster list elements
> allrasters
list()
>
> #call single raster element
> allrasters[[1]]
Error in allrasters[[1]] : subscript out of bounds
2024 Apr 18
2
Import multiple tif raster
...list
rastlist <- list.files(path = "C:/Users/Sibylle St?ckli/Desktop/NCCS_Impacts_Lot2_2022/InVEST/Species_Input/valpar_bee_presence", pattern='.tif$', all.files= T, full.names= T)
At the end I got a warning
#to run a function on an individual raster e.g., plot
> boxplot(allrasters[[1]])
>
> p<-boxplot(allrasters[[1]])
Warning message:
In .local(x, ...) : taking a sample of 1e+05 cells
>
Not all of the characters in C:/Users/Sibylle St?ckli/Desktop/Test_Rasterfile.R could be encoded using ASCII. To save using a different encoding, choose "File | Save with E...