Skip to content

Commit

Permalink
Fixed issues with testthat and examples failing CRAN checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sborstein committed Jan 22, 2025
1 parent e6a66db commit 6228e64
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: dietr
Version: 1.1.6
Version: 1.1.6-1
Date: 2025-1-12
Title: Diet Estimated Trophic Levels
Authors@R: person(given = c("Samuel", "R."),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dietr 1.1.6
dietr 1.1.6-1
============

## Minor changes
Expand Down
9 changes: 5 additions & 4 deletions R/ConvertFishbaseDiet.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
#' versions you could specify species names or numbers and only return those of interest, the only function options in the current version
#' are specifying a server. As such, if the function is run, it will return all diet data on the site, requiring users to subset out
#' those of interest for them. We have implemented in this function a way to join the tables for use as well as filter based on life history stage (if necessary).
#' @examples
#' @examplesIf interactive()
#' \donttest{
#' #Convert Fishbase Diet Data
#' my.diets <- ConvertFishbaseDiet(ExcludeStage=NULL)
#' #Convert Fishbase Diet Data and exclude juvenile and larval records
#' my.diets <- ConvertFishbaseDiet(ExcludeStage=c("recruits/juv.","larvae"))
#' my.diets <- try(ConvertFishbaseDiet(ExcludeStage=c("recruits/juv.","larvae")))
#' if (!"try-error" %in% class(my.diets)){
#' my.diets
#' }
#' }
#' @author Samuel Borstein
#' @export
Expand Down
7 changes: 5 additions & 2 deletions R/ConvertFishbaseFood.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
#' @return a list of length two, with two data frames. One containing the re-formatted food item data and one containing the Taxonomy with species names.
#' @details This converts the data frame produced by rfishbase fooditem function into a usable format for dietr.
#' @author Samuel Borstein
#' @examples
#' @examplesIf interactive()
#' \donttest{
#' #Get rfishbase food item data for a few species
#' my.food <- as.data.frame(rfishbase::fooditems(c("Lutjanus apodus","Epinephelus itajara")))
#' my.food <- try(as.data.frame(rfishbase::fooditems(c("Lutjanus apodus","Epinephelus itajara"))))
#' if (!"try-error" %in% class(my.food)) {
#' #use the ConvertFishbaseFood function to format it for dietr and exclude recruits/juveniles
#' cleaned.food <- ConvertFishbaseFood(FishBaseFood=my.food, ExcludeStage=c("larvae","recruits/juv."))
#' cleaned.food
#' }
#' }
#' @export

Expand Down
2 changes: 1 addition & 1 deletion R/DietTroph.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' While FishBase data obtained from rfishbase can be used, users can also upload their own data for
#' use in with function (see vignette for a tutorial).
#' @author Samuel Borstein
#' @examples
#' @examplesIf interactive()
#' \donttest{
#' ###EXAMPLE USING RAW DATA FROM Magalhaes et al., 2015###
#' data(Herichthys)#load data
Expand Down
2 changes: 1 addition & 1 deletion R/FoodTroph.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#' the SE which they also refer to as the omnivory index. Alternatively, users can select the Sims option, in which case the SE is estimated based on the estimated TL of the n number
#' of subsampling routines.Users can also select "Both" if they would like to calculate both types of SE.
#' @author Samuel Borstein
#' @examples
#' @examplesIf interactive()
#' \donttest{
#' #Get some food item data from rfishbase
#' my.food <- rfishbase::fooditems(c("Lutjanus apodus","Epinephelus itajara"))
Expand Down
9 changes: 6 additions & 3 deletions man/ConvertFishbaseDiet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion man/ConvertFishbaseFood.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/DietTroph.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/FoodTroph.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/testthat/test_FoodTroph.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#Test obtains food item data from FishBase database and calcultes the trophic level of the record
#Tests that the calculated trophic level is what we expect it to be
test_that("FoodTroph function works", {
skip_on_cran()
test.food <- try(rfishbase::fooditems("Plectropomus maculatus"),silent = TRUE)#get food items from database
if ("try-error"%in%class(test.food)) {
skip("could not connect to remote database")
Expand Down

0 comments on commit 6228e64

Please sign in to comment.