diff --git a/DESCRIPTION b/DESCRIPTION index 64373c3..713729e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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."), diff --git a/NEWS.md b/NEWS.md index cc07959..cd940bf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -dietr 1.1.6 +dietr 1.1.6-1 ============ ## Minor changes diff --git a/R/ConvertFishbaseDiet.R b/R/ConvertFishbaseDiet.R index 5d6033c..d6f30c3 100644 --- a/R/ConvertFishbaseDiet.R +++ b/R/ConvertFishbaseDiet.R @@ -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 diff --git a/R/ConvertFishbaseFood.R b/R/ConvertFishbaseFood.R index 243a5de..300057a 100644 --- a/R/ConvertFishbaseFood.R +++ b/R/ConvertFishbaseFood.R @@ -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 diff --git a/R/DietTroph.R b/R/DietTroph.R index 13db451..375c519 100644 --- a/R/DietTroph.R +++ b/R/DietTroph.R @@ -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 diff --git a/R/FoodTroph.R b/R/FoodTroph.R index 8aefe44..2b9fe92 100644 --- a/R/FoodTroph.R +++ b/R/FoodTroph.R @@ -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")) diff --git a/man/ConvertFishbaseDiet.Rd b/man/ConvertFishbaseDiet.Rd index 29d6c84..fb0c9a1 100644 --- a/man/ConvertFishbaseDiet.Rd +++ b/man/ConvertFishbaseDiet.Rd @@ -24,12 +24,15 @@ are specifying a server. As such, if the function is run, it will return all die 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{ +\dontshow{if (interactive() ) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \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 + } } +\dontshow{\}) # examplesIf} } \author{ Samuel Borstein diff --git a/man/ConvertFishbaseFood.Rd b/man/ConvertFishbaseFood.Rd index e33564a..6c4bc33 100644 --- a/man/ConvertFishbaseFood.Rd +++ b/man/ConvertFishbaseFood.Rd @@ -21,13 +21,18 @@ Converts FishBase/SealifBase food item diet data obtained from the diet function This converts the data frame produced by rfishbase fooditem function into a usable format for dietr. } \examples{ +\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \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 } } +\dontshow{\}) # examplesIf} +} \author{ Samuel Borstein } diff --git a/man/DietTroph.Rd b/man/DietTroph.Rd index f065c2d..371379c 100644 --- a/man/DietTroph.Rd +++ b/man/DietTroph.Rd @@ -39,6 +39,7 @@ While FishBase data obtained from rfishbase can be used, users can also upload t use in with function (see vignette for a tutorial). } \examples{ +\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \donttest{ ###EXAMPLE USING RAW DATA FROM Magalhaes et al., 2015### data(Herichthys)#load data @@ -98,6 +99,7 @@ data(FishBasePreyVals) my.TL <- DietTroph(DietItems = my.diets,PreyValues = FishBasePreyVals, Taxonomy = my.taxonomy, PreyClass=c("FoodI","FoodII","FoodIII","Stage")) } +\dontshow{\}) # examplesIf} } \author{ Samuel Borstein diff --git a/man/FoodTroph.Rd b/man/FoodTroph.Rd index 3072494..304ad76 100644 --- a/man/FoodTroph.Rd +++ b/man/FoodTroph.Rd @@ -43,6 +43,7 @@ the SE which they also refer to as the omnivory index. Alternatively, users can of subsampling routines.Users can also select "Both" if they would like to calculate both types of SE. } \examples{ +\dontshow{if (interactive() ) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} \donttest{ #Get some food item data from rfishbase my.food <- rfishbase::fooditems(c("Lutjanus apodus","Epinephelus itajara")) @@ -54,6 +55,7 @@ data(FishBasePreyVals) my.TL <- FoodTroph(FoodItems = converted.foods$FoodItems,PreyValues = FishBasePreyVals, Taxonomy = converted.foods$Taxonomy,PreyClass=c("FoodI","FoodII","FoodIII","Stage")) } +\dontshow{\}) # examplesIf} } \author{ Samuel Borstein diff --git a/tests/testthat/test_FoodTroph.R b/tests/testthat/test_FoodTroph.R index a714c27..91b35f9 100644 --- a/tests/testthat/test_FoodTroph.R +++ b/tests/testthat/test_FoodTroph.R @@ -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")