-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the rest of the tables. error check on flist names
#2 #
- Loading branch information
Showing
22 changed files
with
1,603 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#' Return Juvenile Outmigration base table | ||
#' | ||
#' @export | ||
#' @template info | ||
#' @template tableargs | ||
#' @template basetablefuns | ||
#' @seealso `rcax_juvout_xport()`, `rcax_table_query()`, `rcax_filter()`, `rcax_key()` | ||
#' @examples | ||
#' # return popid of first record | ||
#' # Note the part after $ is case sensitive | ||
#' id <- rcax_juvout(qlist=list(limit=1))$popid | ||
#' | ||
#' a <- rcax_juvout( | ||
#' flist=list(popid=id), | ||
#' cols=c("popid", "outmigrationyear", "totalnatural") | ||
#' ) | ||
#' head(a) | ||
#' | ||
#' # First 3 columns | ||
#' rcax_juvout(qlist=list(limit=3))[,1:3] | ||
#' | ||
#' # to print the first 5 column names | ||
#' rcax_juvout(type="colnames")[1:5] | ||
#' | ||
#' # to print the first 5 column names as they appear | ||
#' # in Excel files downloaded from https://www.streamnet.org/data/hli/ | ||
#' tab <- rcax_juvout(qlist=list(limit=1)) | ||
#' colnames(tab)[1:5] | ||
#' | ||
rcax_juvout <- function( | ||
tablename = "JuvenileOutmigrants", | ||
flist = NULL, | ||
qlist = NULL, | ||
cols = NULL, | ||
sortcols = c("outmigrationyear", "popid"), | ||
type = c("data.frame", "colnames"), | ||
GETargs = list(table_id = NULL, recordloc = "records", key = NULL, parse = TRUE), ...) { | ||
# Error checking. Most happens in rcax_table_query. | ||
assert_is(flist, 'list') | ||
assert_is(qlist, 'list') | ||
|
||
if(("popid" %in% names(flist)) & ("popid" %in% names(qlist))){ | ||
cat("popid appears in both flist and qlist. Ignoring the value in qlist.\n") | ||
qlist$popid <- NULL | ||
} | ||
|
||
# API call and table filtering and sorting | ||
rcax_table_query( | ||
tablename = tablename, | ||
flist = flist, qlist = qlist, | ||
cols = cols, sortcols = sortcols, | ||
type = type, | ||
GETargs = list(recordloc = "records"), ...) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#' Return PNI base table | ||
#' | ||
#' @export | ||
#' @template info | ||
#' @template tableargs | ||
#' @template basetablefuns | ||
#' @seealso `rcax_pni_xport()`, `rcax_table_query()`, `rcax_filter()`, `rcax_key()` | ||
#' @examples | ||
#' # return popid of first record | ||
#' # Note the part after $ is case sensitive | ||
#' id <- rcax_pni(qlist=list(limit=1))$popid | ||
#' | ||
#' # Return the table for this id | ||
#' a <- rcax_pni( | ||
#' flist=list(popid=id), | ||
#' cols=c("popid", "spawningyear", "pniej") | ||
#' ) | ||
#' head(a) | ||
#' | ||
#' # First 3 columns | ||
#' rcax_pni(qlist=list(limit=3))[,1:3] | ||
#' | ||
#' # to print the first 5 column names | ||
#' rcax_pni(type="colnames")[1:5] | ||
#' | ||
#' # to print the first 5 column names as they appear | ||
#' # in Excel files downloaded from https://www.streamnet.org/data/hli/ | ||
#' tab <- rcax_pni(qlist=list(limit=1)) | ||
#' colnames(tab)[1:5] | ||
#' | ||
rcax_pni <- function( | ||
tablename = "PNI", | ||
flist = NULL, | ||
qlist = NULL, | ||
cols = NULL, | ||
sortcols = c("spawningyear", "popid"), | ||
type = c("data.frame", "colnames"), | ||
GETargs = list(table_id = NULL, recordloc = "records", key = NULL, parse = TRUE), ...) { | ||
# Error checking. Most happens in rcax_table_query. | ||
assert_is(flist, 'list') | ||
assert_is(qlist, 'list') | ||
|
||
if(("popid" %in% names(flist)) & ("popid" %in% names(qlist))){ | ||
cat("popid appears in both flist and qlist. Ignoring the value in qlist.\n") | ||
qlist$popid <- NULL | ||
} | ||
|
||
# API call and table filtering and sorting | ||
rcax_table_query( | ||
tablename = tablename, | ||
flist = flist, qlist = qlist, | ||
cols = cols, sortcols = sortcols, | ||
type = type, | ||
GETargs = list(recordloc = "records"), ...) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#' Return RperS base table | ||
#' | ||
#' @export | ||
#' @template info | ||
#' @template tableargs | ||
#' @template basetablefuns | ||
#' @seealso `rcax_rpers_xport()`, `rcax_table_query()`, `rcax_filter()`, `rcax_key()` | ||
#' @examples | ||
#' # return popid of first record | ||
#' # Note the part after $ is case sensitive | ||
#' id <- rcax_rpers(qlist=list(limit=1))$popid | ||
#' | ||
#' a <- rcax_rpers( | ||
#' flist=list(popid=id), | ||
#' cols=c("popid", "broodyear", "rpers") | ||
#' ) | ||
#' head(a) | ||
#' | ||
#' # First 3 columns | ||
#' rcax_rpers(qlist=list(limit=3))[,1:3] | ||
#' | ||
#' # to print the first 5 column names | ||
#' rcax_rpers(type="colnames")[1:5] | ||
#' | ||
#' # to print the first 5 column names as they appear | ||
#' # in Excel files downloaded from https://www.streamnet.org/data/hli/ | ||
#' tab <- rcax_rpers(qlist=list(limit=1)) | ||
#' colnames(tab)[1:5] | ||
#' | ||
rcax_rpers <- function( | ||
tablename = "RperS", | ||
flist = NULL, | ||
qlist = NULL, | ||
cols = NULL, | ||
sortcols = c("broodyear", "popid"), | ||
type = c("data.frame", "colnames"), | ||
GETargs = list(table_id = NULL, recordloc = "records", key = NULL, parse = TRUE), ...) { | ||
# Error checking. Most happens in rcax_table_query. | ||
assert_is(flist, 'list') | ||
assert_is(qlist, 'list') | ||
|
||
if(("popid" %in% names(flist)) & ("popid" %in% names(qlist))){ | ||
cat("popid appears in both flist and qlist. Ignoring the value in qlist.\n") | ||
qlist$popid <- NULL | ||
} | ||
|
||
# API call and table filtering and sorting | ||
rcax_table_query( | ||
tablename = tablename, | ||
flist = flist, qlist = qlist, | ||
cols = cols, sortcols = sortcols, | ||
type = type, | ||
GETargs = list(recordloc = "records"), ...) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#' Return SAR base table | ||
#' | ||
#' @export | ||
#' @template info | ||
#' @template tableargs | ||
#' @template basetablefuns | ||
#' @seealso `rcax_sar_xport()`, `rcax_table_query()`, `rcax_filter()`, `rcax_key()` | ||
#' @examples | ||
#' # return popid of first record | ||
#' # Note the part after $ is case sensitive | ||
#' id <- rcax_sar(qlist=list(limit=1))$popid | ||
#' | ||
#' a <- rcax_sar( | ||
#' flist=list(popid=id), | ||
#' cols=c("popid", "outmigrationyear", "sar") | ||
#' ) | ||
#' head(a) | ||
#' | ||
#' # First 3 columns | ||
#' rcax_sar(qlist=list(limit=3))[,1:3] | ||
#' | ||
#' # to print the first 5 column names | ||
#' rcax_sar(type="colnames")[1:5] | ||
#' | ||
#' # to print the first 5 column names as they appear | ||
#' # in Excel files downloaded from https://www.streamnet.org/data/hli/ | ||
#' tab <- rcax_sar(qlist=list(limit=1)) | ||
#' colnames(tab)[1:5] | ||
#' | ||
rcax_sar <- function( | ||
tablename = "SAR", | ||
flist = NULL, | ||
qlist = NULL, | ||
cols = NULL, | ||
sortcols = c("outmigrationyear", "popid"), | ||
type = c("data.frame", "colnames"), | ||
GETargs = list(table_id = NULL, recordloc = "records", key = NULL, parse = TRUE), ...) { | ||
# Error checking. Most happens in rcax_table_query. | ||
assert_is(flist, 'list') | ||
assert_is(qlist, 'list') | ||
|
||
if(("popid" %in% names(flist)) & ("popid" %in% names(qlist))){ | ||
cat("popid appears in both flist and qlist. Ignoring the value in qlist.\n") | ||
qlist$popid <- NULL | ||
} | ||
|
||
# API call and table filtering and sorting | ||
rcax_table_query( | ||
tablename = tablename, | ||
flist = flist, qlist = qlist, | ||
cols = cols, sortcols = sortcols, | ||
type = type, | ||
GETargs = list(recordloc = "records"), ...) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.