From f37e3dd24ee2e6d1a059aaa0f90c2d74b93e77c7 Mon Sep 17 00:00:00 2001
From: Eli Holmes
Date: Fri, 9 Dec 2022 09:57:32 -0800
Subject: [PATCH] cols did not work if you passed in 1:50
it became integer not numeric
---
R/rcax_table_query.R | 12 ++++++------
docs/articles/basics.html | 12 ++++++------
docs/articles/setup.html | 3 ++-
docs/pkgdown.yml | 2 +-
docs/reference/rcax_hli_xport.html | 8 +++++---
man-roxygen/xportfuns.R | 8 +++++---
man/rcax_hli_xport.Rd | 6 ++++--
vignettes/basics.Rmd | 3 ++-
vignettes/setup.Rmd | 2 +-
9 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/R/rcax_table_query.R b/R/rcax_table_query.R
index b6594b9..9a64e56 100644
--- a/R/rcax_table_query.R
+++ b/R/rcax_table_query.R
@@ -38,10 +38,10 @@ rcax_table_query <- function(
assert_is(tablename, 'character')
assert_is(flist, 'list')
assert_is(qlist, 'list')
- assert_is(cols, c("numeric", "character"))
- if(inherits(cols, "numeric")) if(any(cols<1)) stop("If cols is a number must be greater than 0.")
- assert_is(sortcols, c("numeric", "character"))
- if(inherits(sortcols, "numeric")) if(any(sortcols<1)) stop("If sortcols is a number must be greater than 0.")
+ assert_is(cols, c("integer", "numeric", "character"))
+ if(inherits(cols, c("integer", "numeric"))) if(any(cols<1)) stop("If cols is a number must be greater than 0.")
+ assert_is(sortcols, c("integer", "numeric", "character"))
+ if(inherits(sortcols, c("integer", "numeric"))) if(any(sortcols<1)) stop("If sortcols is a number must be greater than 0.")
assert_is(GETargs, 'list')
# Update GETargs list with any values that the user passed in
@@ -104,7 +104,7 @@ rcax_table_query <- function(
colnames(tab) <- tolower(colnames(tab))
if(!is.null(cols)){
if(inherits(cols, "character")) cols <- tolower(cols)
- if(inherits(cols, "numeric")){
+ if(inherits(cols, c("integer", "numeric"))){
cols <- colnames(tab)[cols]
if(any(is.na(cols))) warning("cols is an integer and should be between 1 and the numbers of columns in the table. some numbers are not in the table, i.e. negative, 0, or greater than the number of columns. erroneous numbers are dropped.")
cols <- cols[!is.na(cols)]
@@ -112,7 +112,7 @@ rcax_table_query <- function(
}
if(!is.null(sortcols)){
if(inherits(sortcols, "character")) sortcols <- tolower(sortcols)
- if(inherits(sortcols, "numeric")){
+ if(inherits(sortcols, c("integer", "numeric"))){
sortcols <- colnames(tab)[sortcols]
if(any(is.na(sortcols))) warning("sortcols is an integer and should be between 1 and the numbers of columns in the table. some numbers are not in the table, i.e. greater than the number of columns. erroneous numbers are dropped.")
sortcols <- sortcols[!is.na(sortcols)]
diff --git a/docs/articles/basics.html b/docs/articles/basics.html
index 215a33f..d660203 100644
--- a/docs/articles/basics.html
+++ b/docs/articles/basics.html
@@ -115,9 +115,9 @@ Basic functions
-See the Getting Started vignette
-for instructions on installing {rCAX}. Once you have installed {rCAX},
-you can begin using the package by loading the library.
+See the Getting Started vignette for
+instructions on installing {rCAX}. Once you have installed {rCAX}, you
+can begin using the package by loading the library.
Load the library.
@@ -214,9 +214,9 @@ Get records from the NOSA XPort t
aes(x=spawningyear, y=log(tsaej), color=waterbody)) +
geom_line(na.rm = TRUE) +
ggtitle("log(total spawners)")
-
-Keep in mind that not all ESU and DPS are in the CAX database for each
-HLI. Go to https://www.streamnet.org/data/hli/ to do a search to
+
+Keep in mind that not all ESU and DPS are in the CAX database for
+each HLI. Go to https://www.streamnet.org/data/hli/ to do a search to
quickly see what is available in different HLI tables.
diff --git a/docs/articles/setup.html b/docs/articles/setup.html
index 79b6593..f1c11c1 100644
--- a/docs/articles/setup.html
+++ b/docs/articles/setup.html
@@ -140,7 +140,8 @@
{rCAX} includes a “read-only” API key. Thus you do not need an API
-key to use {rCAX}. If you need to use your own key, see .
+key to use {rCAX}. If you need to use your own key, see vignette on the
+
API GET function.
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index 24507de..2d0da48 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -7,7 +7,7 @@ articles:
basics: basics.html
setup: setup.html
terms: terms.html
-last_built: 2022-12-09T17:35Z
+last_built: 2022-12-09T17:55Z
urls:
reference: https://nwfsc-math-bio.github.io/rCAX/reference
article: https://nwfsc-math-bio.github.io/rCAX/articles
diff --git a/docs/reference/rcax_hli_xport.html b/docs/reference/rcax_hli_xport.html
index a64cc3c..287ba86 100644
--- a/docs/reference/rcax_hli_xport.html
+++ b/docs/reference/rcax_hli_xport.html
@@ -190,9 +190,11 @@ Details
left in. The colnames are re-sorted into the order found in the
downloaded
Excel files with the extra columns added to the end.
-If you want to see the original columns in the original order,
-use type="colnames
and use the name column of that output as
-the value for the cols
argument.
+The table columns are sorted into the order that appears in
+CAP Fish HLIs Tabular Query.
+If you want to see the original columns in the original order,
+use cols=1:50
, say, to see the first 50 columns in the original
+order.
References
diff --git a/man-roxygen/xportfuns.R b/man-roxygen/xportfuns.R
index 398b7ad..bb6efad 100644
--- a/man-roxygen/xportfuns.R
+++ b/man-roxygen/xportfuns.R
@@ -35,6 +35,8 @@
#' downloaded
#' Excel files with the extra columns added to the end.
#'
-#' If you want to see the original columns in the original order,
-#' use `type="colnames` and use the name column of that output as
-#' the value for the `cols` argument.
+#' The table columns are sorted into the order that appears in
+#' [CAP Fish HLIs Tabular Query](https://www.streamnet.org/data/hli/).
+#' If you want to see the original columns in the original order,
+#' use `cols=1:50`, say, to see the first 50 columns in the original
+#' order.
diff --git a/man/rcax_hli_xport.Rd b/man/rcax_hli_xport.Rd
index 6ee52a3..e4f22b5 100644
--- a/man/rcax_hli_xport.Rd
+++ b/man/rcax_hli_xport.Rd
@@ -75,9 +75,11 @@ left in. The colnames are re-sorted into the order found in the
downloaded
Excel files with the extra columns added to the end.
+The table columns are sorted into the order that appears in
+\href{https://www.streamnet.org/data/hli/}{CAP Fish HLIs Tabular Query}.
If you want to see the original columns in the original order,
-use \verb{type="colnames} and use the name column of that output as
-the value for the \code{cols} argument.
+use \code{cols=1:50}, say, to see the first 50 columns in the original
+order.
}
\examples{
# return NMFS_PopID of second record
diff --git a/vignettes/basics.Rmd b/vignettes/basics.Rmd
index 2137cc8..f8c3779 100644
--- a/vignettes/basics.Rmd
+++ b/vignettes/basics.Rmd
@@ -15,7 +15,7 @@ knitr::opts_chunk$set(
)
```
-See the [Getting Started vignette](articles/setup.html) for instructions on installing {rCAX}. Once you have installed {rCAX}, you can begin using the package by loading the library.
+See the [Getting Started vignette](setup.html) for instructions on installing {rCAX}. Once you have installed {rCAX}, you can begin using the package by loading the library.
Load the library.
```{r setup}
@@ -75,6 +75,7 @@ ggplot(
geom_line(na.rm = TRUE) +
ggtitle("log(total spawners)")
```
+
Keep in mind that not all ESU and DPS are in the CAX database for each HLI. Go to https://www.streamnet.org/data/hli/ to do a search to quickly see what is available in different HLI tables.
## Filtering
diff --git a/vignettes/setup.Rmd b/vignettes/setup.Rmd
index 78c76f6..6d2296a 100644
--- a/vignettes/setup.Rmd
+++ b/vignettes/setup.Rmd
@@ -41,4 +41,4 @@ If your version is out of date, update with another call to `install_github()` (
## API key
{rCAX} includes a "read-only" API key. Thus you
-do not need an API key to use {rCAX}. If you need to use your own key, see \code{vignette("api_get", package = "rCAX")}.
+do not need an API key to use {rCAX}. If you need to use your own key, see vignette on the [API GET function](api_get.html).