Selecting a range of longitude and latitudes

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Selecting a range of longitude and latitudes

R-sig-geo mailing list
Hi there,
I am trying to specify a range of longitudes and latitudes. I tried this using the following:


lonlat <- cbind(103:116, 3:16)  #This would specify a range of longitudes and latitudes

However, I receive the following warning message:
Warning message:
In cbind(103:110, 3:16) :
  number of rows of result is not a multiple of vector length (arg 1)

When I specify the longitude and latitude of a specific location, though, it works just fine, like this:
lonlat <- cbind(103, 3)

Am I specifying the ranges of coordinates incorrectly? The warning message would suggest yes, but I do not understand why.
Thanks, and any help with this would be greatly appreciated!
~Trav.~
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Selecting a range of longitude and latitudes

Vijay Lulla
It appears that you might have mistakenly typed cbind(103:110, 3:16)
instead of cbind(103:116, 3:16).  Regardless, the warning is telling you
that the vectors were of unequal lengths and there was some recycling.  You
can learn about recycling rule from searching "recycling rule in R" and
also from R's Introduction manual at
https://cran.r-project.org/doc/manuals/r-release/R-intro.html#The-recycling-rule
.

HTH,
Vijay

On Thu, Apr 18, 2019 at 8:38 PM rain1290--- via R-sig-Geo <
[hidden email]> wrote:

> Hi there,
> I am trying to specify a range of longitudes and latitudes. I tried this
> using the following:
>
>
> lonlat <- cbind(103:116, 3:16)  #This would specify a range of longitudes
> and latitudes
>
> However, I receive the following warning message:
> Warning message:
> In cbind(103:110, 3:16) :
>   number of rows of result is not a multiple of vector length (arg 1)
>
> When I specify the longitude and latitude of a specific location, though,
> it works just fine, like this:
> lonlat <- cbind(103, 3)
>
> Am I specifying the ranges of coordinates incorrectly? The warning message
> would suggest yes, but I do not understand why.
> Thanks, and any help with this would be greatly appreciated!
> ~Trav.~
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Selecting a range of longitude and latitudes

Ben Tupper
In reply to this post by R-sig-geo mailing list
Hi,

The example you give is different than the one listed in the error message.  In your example you bind two 14-element vectors into a matrix of two columns.

cbind(103:116, 3:16)

But in the error you show the first vector is only 8 elements long...

cbind(103:110, 3:16)

When R encounters an attempt to bind columns of unequal length it will try to "recycle" the shorter vector as long as it is a multiple of the longer. In this case of binding an 8-element vector and a 14-element vector it fails.  

Note that shortening up the first vector to 7 does work since 7 is a multiple of 14...

cbind(103:109, 3:16)
      [,1] [,2]
 [1,]  103    3
 [2,]  104    4
 [3,]  105    5
 [4,]  106    6
 [5,]  107    7
 [6,]  108    8
 [7,]  109    9
 [8,]  103   10
 [9,]  104   11
[10,]  105   12
[11,]  106   13
[12,]  107   14
[13,]  108   15
[14,]  109   16


Note how the sequence 103...109 appears twice in the first column.  Recycling is nice (and handy) until you get surprised by it.

Cheers,
Ben

> On Apr 18, 2019, at 8:37 PM, rain1290--- via R-sig-Geo <[hidden email]> wrote:
>
> Hi there,
> I am trying to specify a range of longitudes and latitudes. I tried this using the following:
>
>
> lonlat <- cbind(103:116, 3:16)  #This would specify a range of longitudes and latitudes
>
> However, I receive the following warning message:
> Warning message:
> In cbind(103:110, 3:16) :
>  number of rows of result is not a multiple of vector length (arg 1)
>
> When I specify the longitude and latitude of a specific location, though, it works just fine, like this:
> lonlat <- cbind(103, 3)
>
> Am I specifying the ranges of coordinates incorrectly? The warning message would suggest yes, but I do not understand why.
> Thanks, and any help with this would be greatly appreciated!
> ~Trav.~
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

Ecological Forecasting: https://eco.bigelow.org/






        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Selecting a range of longitude and latitudes

R-sig-geo mailing list
Hi Ben (and everyone),

Ah, yes, you're right - using the suggestion that you specified, that error message disappeared! So, if I understand, this would take all of the grid cells within those specified longitude and latitude ranges (i.e. that entire area)? 
That said, when I try plotting this using the following:
get <- ncvar_get(Model1, "cum_co2_emi-CanESM2")   #for x-axis (140 values)
Model2 <- brick("MaxPrecCCCMACanESM21pctCO2.nc", var="onedaymax")    #for y-axis (140 values)

Hope2 <- extract(Model2, lonlat)

plot(get,Hope2, type="l",col="green", lwd="3", xlab="Cumulative emissions (TtC)", ylab="One-day maximum precipitation (mm/day)", main="CanESM2")
I receive this error:
Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' and 'y' lengths differ
*Note that I do not have this problem when specifying a "specific" longitude and latitude, rather than a range. Is there any reason for this?
Thanks, again
-----Original Message-----
From: Ben Tupper <[hidden email]>
To: rain1290 <[hidden email]>
Cc: r-sig-geo <[hidden email]>
Sent: Thu, Apr 18, 2019 9:26 pm
Subject: Re: [R-sig-Geo] Selecting a range of longitude and latitudes

Hi,
The example you give is different than the one listed in the error message.  In your example you bind two 14-element vectors into a matrix of two columns.
cbind(103:116, 3:16)
But in the error you show the first vector is only 8 elements long...
cbind(103:110, 3:16)
When R encounters an attempt to bind columns of unequal length it will try to "recycle" the shorter vector as long as it is a multiple of the longer. In this case of binding an 8-element vector and a 14-element vector it fails.  
Note that shortening up the first vector to 7 does work since 7 is a multiple of 14...
cbind(103:109, 3:16)      [,1] [,2] [1,]  103    3 [2,]  104    4 [3,]  105    5 [4,]  106    6 [5,]  107    7 [6,]  108    8 [7,]  109    9 [8,]  103   10 [9,]  104   11[10,]  105   12[11,]  106   13[12,]  107   14[13,]  108   15[14,]  109   16

Note how the sequence 103...109 appears twice in the first column.  Recycling is nice (and handy) until you get surprised by it.
Cheers,Ben

On Apr 18, 2019, at 8:37 PM, rain1290--- via R-sig-Geo <[hidden email]> wrote:
Hi there,
I am trying to specify a range of longitudes and latitudes. I tried this using the following:


lonlat <- cbind(103:116, 3:16)  #This would specify a range of longitudes and latitudes

However, I receive the following warning message:
Warning message:
In cbind(103:110, 3:16) :
  number of rows of result is not a multiple of vector length (arg 1)

When I specify the longitude and latitude of a specific location, though, it works just fine, like this:
lonlat <- cbind(103, 3)

Am I specifying the ranges of coordinates incorrectly? The warning message would suggest yes, but I do not understand why.
Thanks, and any help with this would be greatly appreciated!
~Trav.~
 [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org
Ecological Forecasting: https://eco.bigelow.org/





        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Selecting a range of longitude and latitudes

R-sig-geo mailing list
In reply to this post by R-sig-geo mailing list
Hi Mike (and everyone),

Thanks for this reply! 
Let's say that I wanted to average the values of every grid cell within, say, 103 to 116 degrees longitude and 5 to 16 degrees latitude. Would there be a way to select all of those grid cells to average them? I've done something like this to already compute the averages across all grid cells based on values :
RCP1pctCO2ModelMean <- (Model2 + Model10 + Model18 + Model26 + subset14 + Model42 + subset20 + subset24 + Model60 + Model68) / 10   ###This provides an average value across each of the 140 layers for each of the 8192 grid cells based on these 10 models (i.e. all of the layer 1s are averaged for each model for the first grid cell, then all of the layer 2s are averaged for the first grid cell.....all the way to layer 140. Then, this is repeated for the second grid cell....all the way to grid cell 8192). This way, I have 140 averages across all grid cells. :)
So, to average values ONLY across a selected range of grid cells, is there a way to do that? 
Thanks, again,


-----Original Message-----
From: Michael Sumner <[hidden email]>
To: rain1290 <[hidden email]>
Sent: Fri, Apr 19, 2019 6:36 pm
Subject: Re: [R-sig-Geo] Selecting a range of longitude and latitudes

You want expand.grid(get, Hope2) to get every coordinate, but

coordinates(Model2)  ## gives a matrix (topleft, across rows, then
down same as values(Model2))

is far easier, albeit having been through layers of interpretation of
the original arrays in the file.

All the best, Mike


On Fri, Apr 19, 2019 at 11:51 AM rain1290--- via R-sig-Geo
<[hidden email]> wrote:

>
> Hi Ben (and everyone),
>
> Ah, yes, you're right - using the suggestion that you specified, that error message disappeared! So, if I understand, this would take all of the grid cells within those specified longitude and latitude ranges (i.e. that entire area)?
> That said, when I try plotting this using the following:
> get <- ncvar_get(Model1, "cum_co2_emi-CanESM2")  #for x-axis (140 values)
> Model2 <- brick("MaxPrecCCCMACanESM21pctCO2.nc", var="onedaymax")    #for y-axis (140 values)
>
> Hope2 <- extract(Model2, lonlat)
>
> plot(get,Hope2, type="l",col="green", lwd="3", xlab="Cumulative emissions (TtC)", ylab="One-day maximum precipitation (mm/day)", main="CanESM2")
> I receive this error:
> Error in xy.coords(x, y, xlabel, ylabel, log) :
>  'x' and 'y' lengths differ
> *Note that I do not have this problem when specifying a "specific" longitude and latitude, rather than a range. Is there any reason for this?
> Thanks, again
> -----Original Message-----
> From: Ben Tupper <[hidden email]>
> To: rain1290 <[hidden email]>
> Cc: r-sig-geo <[hidden email]>
> Sent: Thu, Apr 18, 2019 9:26 pm
> Subject: Re: [R-sig-Geo] Selecting a range of longitude and latitudes
>
> Hi,
> The example you give is different than the one listed in the error message.  In your example you bind two 14-element vectors into a matrix of two columns.
> cbind(103:116, 3:16)
> But in the error you show the first vector is only 8 elements long...
> cbind(103:110, 3:16)
> When R encounters an attempt to bind columns of unequal length it will try to "recycle" the shorter vector as long as it is a multiple of the longer. In this case of binding an 8-element vector and a 14-element vector it fails.
> Note that shortening up the first vector to 7 does work since 7 is a multiple of 14...
> cbind(103:109, 3:16)      [,1] [,2] [1,]  103    3 [2,]  104    4 [3,]  105    5 [4,]  106    6 [5,]  107    7 [6,]  108    8 [7,]  109    9 [8,]  103  10 [9,]  104  11[10,]  105  12[11,]  106  13[12,]  107  14[13,]  108  15[14,]  109  16
>
> Note how the sequence 103...109 appears twice in the first column.  Recycling is nice (and handy) until you get surprised by it.
> Cheers,Ben
>
> On Apr 18, 2019, at 8:37 PM, rain1290--- via R-sig-Geo <[hidden email]> wrote:
> Hi there,
> I am trying to specify a range of longitudes and latitudes. I tried this using the following:
>
>
> lonlat <- cbind(103:116, 3:16)  #This would specify a range of longitudes and latitudes
>
> However, I receive the following warning message:
> Warning message:
> In cbind(103:110, 3:16) :
>  number of rows of result is not a multiple of vector length (arg 1)
>
> When I specify the longitude and latitude of a specific location, though, it works just fine, like this:
> lonlat <- cbind(103, 3)
>
> Am I specifying the ranges of coordinates incorrectly? The warning message would suggest yes, but I do not understand why.
> Thanks, and any help with this would be greatly appreciated!
> ~Trav.~
>  [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
> Ecological Forecasting: https://eco.bigelow.org/
>
>
>
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
Michael Sumner
Software and Database Engineer
Australian Antarctic Division
Hobart, Australia
e-mail: [hidden email]

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Selecting a range of longitude and latitudes

Tom Philippi
In reply to this post by R-sig-geo mailing list
Trav--
Are you trying to specify a grid of each of those lon values by each of
those lat values?  cbind() is matching the first lon with the first lat,
the second with the second, generating a diagonal of locations.  [That's
also why there have to be as many lats as lons.]  To fill out the grid of
each lon with each lat, look at expand.grid(103:116, 3:16)

Tom

On Thu, Apr 18, 2019 at 6:51 PM rain1290--- via R-sig-Geo <
[hidden email]> wrote:

> Hi Ben (and everyone),
>
> Ah, yes, you're right - using the suggestion that you specified, that
> error message disappeared! So, if I understand, this would take all of the
> grid cells within those specified longitude and latitude ranges (i.e. that
> entire area)?
> That said, when I try plotting this using the following:
> get <- ncvar_get(Model1, "cum_co2_emi-CanESM2")   #for x-axis (140 values)
> Model2 <- brick("MaxPrecCCCMACanESM21pctCO2.nc", var="onedaymax")    #for
> y-axis (140 values)
>
> Hope2 <- extract(Model2, lonlat)
>
> plot(get,Hope2, type="l",col="green", lwd="3", xlab="Cumulative emissions
> (TtC)", ylab="One-day maximum precipitation (mm/day)", main="CanESM2")
> I receive this error:
> Error in xy.coords(x, y, xlabel, ylabel, log) :
>   'x' and 'y' lengths differ
> *Note that I do not have this problem when specifying a "specific"
> longitude and latitude, rather than a range. Is there any reason for this?
> Thanks, again
> -----Original Message-----
> From: Ben Tupper <[hidden email]>
> To: rain1290 <[hidden email]>
> Cc: r-sig-geo <[hidden email]>
> Sent: Thu, Apr 18, 2019 9:26 pm
> Subject: Re: [R-sig-Geo] Selecting a range of longitude and latitudes
>
> Hi,
> The example you give is different than the one listed in the error
> message.  In your example you bind two 14-element vectors into a matrix of
> two columns.
> cbind(103:116, 3:16)
> But in the error you show the first vector is only 8 elements long...
> cbind(103:110, 3:16)
> When R encounters an attempt to bind columns of unequal length it will try
> to "recycle" the shorter vector as long as it is a multiple of the longer.
> In this case of binding an 8-element vector and a 14-element vector it
> fails.
> Note that shortening up the first vector to 7 does work since 7 is a
> multiple of 14...
> cbind(103:109, 3:16)      [,1] [,2] [1,]  103    3 [2,]  104    4 [3,]
>  105    5 [4,]  106    6 [5,]  107    7 [6,]  108    8 [7,]  109    9 [8,]
>  103   10 [9,]  104   11[10,]  105   12[11,]  106   13[12,]  107   14[13,]
>  108   15[14,]  109   16
>
> Note how the sequence 103...109 appears twice in the first column.
> Recycling is nice (and handy) until you get surprised by it.
> Cheers,Ben
>
> On Apr 18, 2019, at 8:37 PM, rain1290--- via R-sig-Geo <
> [hidden email]> wrote:
> Hi there,
> I am trying to specify a range of longitudes and latitudes. I tried this
> using the following:
>
>
> lonlat <- cbind(103:116, 3:16)  #This would specify a range of longitudes
> and latitudes
>
> However, I receive the following warning message:
> Warning message:
> In cbind(103:110, 3:16) :
>   number of rows of result is not a multiple of vector length (arg 1)
>
> When I specify the longitude and latitude of a specific location, though,
> it works just fine, like this:
> lonlat <- cbind(103, 3)
>
> Am I specifying the ranges of coordinates incorrectly? The warning message
> would suggest yes, but I do not understand why.
> Thanks, and any help with this would be greatly appreciated!
> ~Trav.~
>  [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
> Ecological Forecasting: https://eco.bigelow.org/
>
>
>
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Selecting a range of longitude and latitudes

R-sig-geo mailing list
Hi Tom (and everyone),

Ah, yes, that is what I wanted to consider in terms of selecting grid cells! :) But let's say that I wanted to aggregate each of the values of these grid cells and plot this as a function x-axis values. The values already computed for each grid cell for the y-axis correspond to average precipitation and consist of 140 values per grid cell. The variable containing these y-axis values is called "RCP1pctCO2Mean", which is 3-dimensional and has the following attributes:
class       : RasterBrick
dimensions  : 64, 128, 8192, 140  (nrow, ncol, ncell, nlayers)
resolution  : 2.8125, 2.789327  (x, y)
extent      : -181.4062, 178.5938, -89.25846, 89.25846  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source : in memory
names       :   layer.1,   layer.2,   layer.3,   layer.4,   layer.5,   layer.6,   layer.7,   layer.8,   layer.9,  layer.10,  layer.11,  layer.12,  layer.13,  layer.14,  layer.15, ...
min values  : 0.5261063, 0.5625295, 0.5301681, 0.6019284, 0.5177065, 0.6775601, 0.5336965, 0.5213086, 0.5971723, 0.5305891, 0.5514522, 0.5481200, 0.4681806, 0.5437223, 0.5988844, ...
max values  : 113.13776, 114.50780,  94.93643, 100.35409, 102.65459, 101.80622, 104.95480,  99.17839, 104.68667, 119.48342, 100.60391, 108.91896, 104.38969,  99.35735,  99.30752, ...

For the x-axis, I already have 140 values to be plotted. The x variable is called "RCP1pctCO2cumulative". 
I tried doing something like this to start:
>expansion <- expand.grid(103:116, 3:16)>lonlat <- extract(RCP1pctCO2Mean, expansion)
>plot(RCP1pctCO2cumulative,lonlat, type="l",col="green", lwd="3", xlab="Cumulative emissions (TtC)", ylab="One-day maximum precipitation (mm/day)", main="Test model") But this yields the error:
Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' and 'y' lengths differ>dim(lonlat)
[1] 196   140>dim(expansion)[1] 196   2
What could I be doing wrong (the lengths appear to be the same)? Ultimately, the goal would be to plot the 140 values as a function of cumulative emissions (i.e. "RCP1pctCO2Mean" as a function of "RCP1pctCO2cumulative" once each of those selected grid cells are aggregated. This works absolutely fine when just selecting "one" specific grid cell. Is this possible to do for an aggregate of grid cells?
Thanks, again! 
-----Original Message-----
From: Tom Philippi <[hidden email]>
To: rain1290 <[hidden email]>
Cc: btupper <[hidden email]>; r-sig-geo <[hidden email]>
Sent: Sun, Apr 21, 2019 12:17 am
Subject: Re: [R-sig-Geo] Selecting a range of longitude and latitudes

Trav--Are you trying to specify a grid of each of those lon values by each of those lat values?  cbind() is matching the first lon with the first lat, the second with the second, generating a diagonal of locations.  [That's also why there have to be as many lats as lons.]  To fill out the grid of each lon with each lat, look at expand.grid(103:116, 3:16)
Tom
On Thu, Apr 18, 2019 at 6:51 PM rain1290--- via R-sig-Geo <[hidden email]> wrote:

Hi Ben (and everyone),

Ah, yes, you're right - using the suggestion that you specified, that error message disappeared! So, if I understand, this would take all of the grid cells within those specified longitude and latitude ranges (i.e. that entire area)? 
That said, when I try plotting this using the following:
get <- ncvar_get(Model1, "cum_co2_emi-CanESM2")   #for x-axis (140 values)
Model2 <- brick("MaxPrecCCCMACanESM21pctCO2.nc", var="onedaymax")    #for y-axis (140 values)

Hope2 <- extract(Model2, lonlat)

plot(get,Hope2, type="l",col="green", lwd="3", xlab="Cumulative emissions (TtC)", ylab="One-day maximum precipitation (mm/day)", main="CanESM2")
I receive this error:
Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' and 'y' lengths differ
*Note that I do not have this problem when specifying a "specific" longitude and latitude, rather than a range. Is there any reason for this?
Thanks, again
-----Original Message-----
From: Ben Tupper <[hidden email]>
To: rain1290 <[hidden email]>
Cc: r-sig-geo <[hidden email]>
Sent: Thu, Apr 18, 2019 9:26 pm
Subject: Re: [R-sig-Geo] Selecting a range of longitude and latitudes

Hi,
The example you give is different than the one listed in the error message.  In your example you bind two 14-element vectors into a matrix of two columns.
cbind(103:116, 3:16)
But in the error you show the first vector is only 8 elements long...
cbind(103:110, 3:16)
When R encounters an attempt to bind columns of unequal length it will try to "recycle" the shorter vector as long as it is a multiple of the longer. In this case of binding an 8-element vector and a 14-element vector it fails.  
Note that shortening up the first vector to 7 does work since 7 is a multiple of 14...
cbind(103:109, 3:16)      [,1] [,2] [1,]  103    3 [2,]  104    4 [3,]  105    5 [4,]  106    6 [5,]  107    7 [6,]  108    8 [7,]  109    9 [8,]  103   10 [9,]  104   11[10,]  105   12[11,]  106   13[12,]  107   14[13,]  108   15[14,]  109   16

Note how the sequence 103...109 appears twice in the first column.  Recycling is nice (and handy) until you get surprised by it.
Cheers,Ben

On Apr 18, 2019, at 8:37 PM, rain1290--- via R-sig-Geo <[hidden email]> wrote:
Hi there,
I am trying to specify a range of longitudes and latitudes. I tried this using the following:


lonlat <- cbind(103:116, 3:16)  #This would specify a range of longitudes and latitudes

However, I receive the following warning message:
Warning message:
In cbind(103:110, 3:16) :
  number of rows of result is not a multiple of vector length (arg 1)

When I specify the longitude and latitude of a specific location, though, it works just fine, like this:
lonlat <- cbind(103, 3)

Am I specifying the ranges of coordinates incorrectly? The warning message would suggest yes, but I do not understand why.
Thanks, and any help with this would be greatly appreciated!
~Trav.~
 [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org
Ecological Forecasting: https://eco.bigelow.org/





        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo