[R-sig-Geo] Bug in raster::crop?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue May 1 09:44:16 CEST 2018


Works perfectly for me, with the same versions of everything:

>     r <- raster(nrow=45, ncol=90)
>      r[] <- 1:ncell(r)
>      e <- extent(-160, 10, 30, 60)
>      rc <- crop(r, e)
>
> packageVersion("raster")
[1] ‘2.6.7’
> version
               _
platform       x86_64-pc-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          3
minor          4.4

Can you get crop to work on anything?

Barry




On Tue, May 1, 2018 at 8:22 AM, Julian M. Burgos <julian.burgos at hafogvatn.is
> wrote:

> Hello everyone,
>
> I am getting this error when using the crop function in the raster
> package.  Here is an example, sing the example in the help file:
>
> > r <- raster(nrow=45, ncol=90)
> > r[] <- 1:ncell(r)
> > e <- extent(-160, 10, 30, 60)
> > rc <- crop(r, e)
>
> Error in extent(extent) : insufficient number of elements (should be 4)
>
> I am using R version 3.4.4., and raster 2.6-7.
>
> Many thanks,
>
> Julian
>
> --
> Julian Mariano Burgos, PhD
> Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/
> Marine and Freshwater Research Institute
> Botnsjávarsviðs / Demersal Division
> Skúlagata 4, 121 Reykjavík, Iceland
> Sími/Telephone : +354-5752037
> Bréfsími/Telefax:  +354-5752001
> Netfang/Email: julian.burgos at hafogvatn.is
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list