Skip to content

Bug in raster::crop?

6 messages · Barry Rowlingson, Vijay Lulla, Julian Burgos

#
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:
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
#
Works perfectly for me, with the same versions of everything:
[1] ?2.6.7?
_
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

  
  
#
Works for me too...with same versions of everything.  Maybe you can try e
<- extent(c(-160,10,30,60)) ?  Apparently, ?`extent` states that it needs
either a Raster, Extent, matrix, or vector of four numbers.  I don't
understand why extent(-160,10,30,60) worked for me though!

On Tue, May 1, 2018 at 3:44 AM, Barry Rowlingson <
b.rowlingson at lancaster.ac.uk> wrote:

            

  
    
#
No, I am still getting the same error, either using
extent(c(-160,10,30,60)) or extent(-160,10,30,60).  I can crop polygons
with no problem.  The strange thing is that it was working fine until a
couple of days ago.  I am not sure what changed...


Vijay Lulla writes:
--
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
#
I should add that I get this also when loading R with the --vanilla
flag.

Julian M. Burgos writes:
--
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
#
Ok, I removed and re-installed the raster package, and now everything
works.

Julian M. Burgos writes:
--
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