Skip to content

Commit

Permalink
Split long char strings to avoid check note
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Oct 27, 2015
1 parent cb9bec4 commit 7a2cfdd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
14 changes: 10 additions & 4 deletions R/catchmentArea.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,19 @@ calc_catchment <- function(
targetlayer,
calccols,
distance = 500,
projection = "+proj=aea +lat_1=90 +lat_2=-18.416667 +lat_0=0 +lon_0=10 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs",
projection = paste0("+proj=aea +lat_1=90 +lat_2=-18.416667 ",
"+lat_0=0 +lon_0=10 +x_0=0 +y_0=0 +ellps=GRS80",
" +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"),
retainAreaProportion = FALSE,
dissolve = FALSE
){

# Define Named vector of known projection strings
knownprojs <- c(
'austalbers'='+proj=aea +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=132 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs',
'worldalbers'='+proj=aea +lat_1=90 +lat_2=-18.416667 +lat_0=0 +lon_0=10 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'
paste0('austalbers'='+proj=aea +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=132 +x_0=0',
' +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'),
paste0('worldalbers'='+proj=aea +lat_1=90 +lat_2=-18.416667 +lat_0=0 +lon_0=10 +x_0=0',
' +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs')
)

if (sum(is.na(knownprojs[projection])) == 0) {
Expand Down Expand Up @@ -203,7 +207,9 @@ calc_catchment_sum <- function(
targetlayer,
calccols,
distance = 500,
projection = "+proj=aea +lat_1=90 +lat_2=-18.416667 +lat_0=0 +lon_0=10 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs",
projection = paste0("+proj=aea +lat_1=90 +lat_2=-18.416667",
" +lat_0=0 +lon_0=10 +x_0=0 +y_0=0",
" +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"),
retainAreaProportion = FALSE
){
if(length(calccols) == 1) {
Expand Down
6 changes: 4 additions & 2 deletions man/calc_catchment.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
\title{Calculate catchment area and associated summary statistics.}
\usage{
calc_catchment(polygonlayer, targetlayer, calccols, distance = 500,
projection = "+proj=aea +lat_1=90 +lat_2=-18.416667 +lat_0=0 +lon_0=10 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs",
retainAreaProportion = FALSE, dissolve = FALSE)
projection = paste0("+proj=aea +lat_1=90 +lat_2=-18.416667 ",
"+lat_0=0 +lon_0=10 +x_0=0 +y_0=0 +ellps=GRS80",
" +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"), retainAreaProportion = FALSE,
dissolve = FALSE)
}
\arguments{
\item{polygonlayer}{A SpatialPolygonsDataFrame containing zones from which
Expand Down
4 changes: 3 additions & 1 deletion man/calc_catchment_sum.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
\title{Calculate summary statistics for catchment area.}
\usage{
calc_catchment_sum(polygonlayer, targetlayer, calccols, distance = 500,
projection = "+proj=aea +lat_1=90 +lat_2=-18.416667 +lat_0=0 +lon_0=10 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs",
projection = paste0("+proj=aea +lat_1=90 +lat_2=-18.416667",
" +lat_0=0 +lon_0=10 +x_0=0 +y_0=0",
" +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"),
retainAreaProportion = FALSE)
}
\arguments{
Expand Down

0 comments on commit 7a2cfdd

Please sign in to comment.