Skip to content

Commit

Permalink
fix(sql_bds): check if is a data.frame
Browse files Browse the repository at this point in the history
Thanks to @John-R-Wallace-NOAA for letting me know about the error
because NROW will return a valid integer if the object is a vector.
So, added a check for is.data.frame.

Part of #119
  • Loading branch information
kellijohnson-NOAA committed Jul 3, 2023
1 parent c3decfa commit b2c3422
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/PullBDS.PacFIN.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ PullBDS.PacFIN <- function(pacfin_species_code,
password = password
)

# Checks on data_raw
# stop calls
# Checks on data_raw need to be for both finding if there are rows and
# if the class is a data frame because errors from getDB can also register
# as having rows
stopifnot("No data found" = NROW(data_raw) > 0)
stopifnot("No data found" = inherits(data_raw, "data.frame"))

# message calls
if (verbose) {
Expand Down

0 comments on commit b2c3422

Please sign in to comment.