Skip to content

Commit 5fd7070

Browse files
committedFeb 29, 2024
updates to pass cran tests
1 parent 70c8b54 commit 5fd7070

21 files changed

+37
-23
lines changed
 

‎DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ NeedsCompilation: no
3131
BugReports: https://github.com/tokami/TropFishR/issues
3232
URL: https://github.com/tokami/TropFishR
3333
Encoding: UTF-8
34-
RoxygenNote: 7.1.1
34+
RoxygenNote: 7.3.1
3535
Suggests:
3636
graphics,
3737
grDevices,

‎R/Bhattacharya.R

+7
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969

7070
Bhattacharya <- function(param, n_rnorm = 1000, savePlots = FALSE){
7171

72+
if(interactive()){
73+
7274
res <- param
7375
if("midLengths" %in% names(res) == TRUE){
7476
midLengths <- as.character(res$midLengths)
@@ -444,4 +446,9 @@ Bhattacharya <- function(param, n_rnorm = 1000, savePlots = FALSE){
444446
plot(ret)
445447
return(ret)
446448
}
449+
450+
}else{
451+
writeLines("Interactive session needed for Bhattacharya.")
452+
return(NULL)
453+
}
447454
}

‎R/ELEFAN.R

+4-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
#' lfq = alba, method = "cross",
9696
#' Linf_fix = 10,
9797
#' K_range = round(exp(seq(from = log(0.1), to = log(2), length.out = 50)),2),
98-
#' cross.date = alba$dates[3], cross.midLength = alba$midLengths[4]
98+
#' cross.date = alba$dates[3], cross.midLength = alba$midLengths[4],
99+
#' plot = FALSE
99100
#' )
100101
#' fit4$Rn_max; unlist(fit4$par)
101102
#' plot(fit4); points(alba$dates[3], alba$midLengths[4], col=2, cex=2, lwd=2)
@@ -261,7 +262,7 @@ ELEFAN <- function(lfq, Linf_fix = NA, Linf_range = NA,
261262
}
262263

263264

264-
if(!hide.progressbar){
265+
if(!hide.progressbar && interactive()){
265266
nlk <- prod(dim(ESP_list_L))
266267
pb <- txtProgressBar(min=1, max=nlk, style=3)
267268
counter <- 1
@@ -316,7 +317,7 @@ ELEFAN <- function(lfq, Linf_fix = NA, Linf_range = NA,
316317
}
317318

318319
# update counter and progress bar
319-
if(!hide.progressbar){
320+
if(!hide.progressbar && interactive()){
320321
setTxtProgressBar(pb, counter)
321322
counter <- counter + 1
322323
}

‎R/ELEFAN_GA.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ ELEFAN_GA <- function(lfq,
313313

314314
if(plot){
315315
plot(lfq, Fname = "rcounts")
316-
Lt <- lfqFitCurves(lfq, par = lfq$pars, draw=TRUE)
316+
Lt <- lfqFitCurves(lfq, par = lfq$par, draw=TRUE)
317317
}
318318
return(lfq)
319319
}

‎R/ELEFAN_SA.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ ELEFAN_SA <- function(lfq,
357357

358358
if(plot){
359359
plot(res, Fname = "rcounts")
360-
Lt <- lfqFitCurves(res, par = res$pars, draw=TRUE)
360+
Lt <- lfqFitCurves(res, par = res$par, draw=TRUE)
361361
}
362362
return(res)
363363
}

‎R/alba.R

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#'
33
#' @title Length-frequency data of the clam Abra alba
44
#'
5-
#'
65
#' @description Length-frequency data of the clam Abra alba as presented
76
#' by Brey et al. (1988). Includes 7 approximately bi-monthly samplings of
87
#' A. alba binned into 14 length classes. The data is of class "lfq", which

‎R/catchCurve.R

+7-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ catchCurve <- function(param,
382382

383383
cutterList <- vector("list", reg_num)
384384
#identify plot
385-
if(is.null(reg_int) & !auto){
385+
if(is.null(reg_int) & !auto){
386+
if(interactive()){
386387
writeLines("Please choose the minimum and maximum point in the graph \nto include for the regression line!")
387388
flush.console()
388389
for(I in 1:reg_num){
@@ -417,6 +418,11 @@ catchCurve <- function(param,
417418
cutterList[[I]] <- cutter
418419
}
419420

421+
}else{
422+
writeLines("Either start an interactive session to choose points, use reg_int to define the points for the regression analysis or use auto=TRUE.")
423+
return(NULL)
424+
}
425+
420426

421427
}
422428

‎R/plot.Bhattacharya.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#' lines should be created
1111
#'
1212
#' @examples
13-
#' \donttest{
13+
#' \dontrun{
1414
#' data(synLFQ1)
1515
#' output <- Bhattacharya(param = synLFQ1)
1616
#' plot(output)

‎R/powell_wetherall.R

+6
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ powell_wetherall <- function(param, catch_columns = NA,
135135

136136
#identify plot
137137
if(is.null(reg_int)){
138+
if(interactive()){
138139
repeat{
139140
writeLines("Please choose the minimum and maximum point in the \ngraph to include for the regression line!")
140141
flush.console()
@@ -162,6 +163,11 @@ powell_wetherall <- function(param, catch_columns = NA,
162163
break
163164
}
164165
}
166+
167+
}else{
168+
writeLines("Please specify reg_int or choose points for the regression analysis in an interactive session.")
169+
return(NULL)
170+
}
165171
}
166172
if(!is.null(reg_int)){
167173
cutter <- reg_int

‎R/predict_mod.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ predict_mod <- function(param, type, FM_change = NA,
359359
list_Es <- vector("list", length(Lc))
360360

361361
# show progress bar only if the loop has more than 1 runs
362-
if (!hide.progressbar) {
362+
if (!hide.progressbar && interactive()) {
363363
nlk <- length(Lc)
364364
if(nlk > 1){
365365
pb <- txtProgressBar(min=1, max=nlk, style=3)
@@ -501,7 +501,7 @@ predict_mod <- function(param, type, FM_change = NA,
501501
list_Es[[i]] <- df_loop_Es
502502

503503
# update counter and progress bar
504-
if (!hide.progressbar) {
504+
if (!hide.progressbar && interactive()) {
505505
if(nlk > 1){
506506
setTxtProgressBar(pb, counter)
507507
counter <- counter + 1
@@ -920,7 +920,7 @@ predict_mod <- function(param, type, FM_change = NA,
920920
pred.FM_Lc_com_res_loopSSB_list <- vector("list",length(FM_Lc_com_mat.list))
921921
pred.FM_Lc_com_res_loopSPR_list <- vector("list",length(FM_Lc_com_mat.list))
922922

923-
if (!hide.progressbar) {
923+
if (!hide.progressbar && interactive()) {
924924
nlk <- prod(length(FM_Lc_com_mat.list),dim(FM_Lc_com_mat.list[[1]])[2])
925925
pb <- txtProgressBar(min=1, max=nlk, style=3)
926926
counter <- 1
@@ -939,7 +939,7 @@ predict_mod <- function(param, type, FM_change = NA,
939939
pred.FM_Lc_com_res_loop1_list[[x22]] <- res2$totals
940940

941941
# update counter and progress bar
942-
if (!hide.progressbar) {
942+
if (!hide.progressbar && interactive()) {
943943
setTxtProgressBar(pb, counter)
944944
counter <- counter + 1
945945
}

‎R/synLFQ1.R

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#'
33
#' @title Synthetic length-frequency data I
44
#'
5-
#'
65
#' @description Synthetic length-frequency data as provided in Sparre & Venema (1998).
76
#' Can be used to apply the function \code{\link[TropFishR]{Bhattacharya}} or
87
#' \code{\link[TropFishR]{ELEFAN}}.

‎R/synLFQ2.R

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#'
33
#' @title Synthetic length frequency data II
44
#'
5-
#'
65
#' @description Synthetic length frequency data from Sparre & Venema (1998). Can be used
76
#' for the estimation of the instantaneous total mortality rate (Z) by means
87
#' of \code{\link{Z_BevertonHolt}}.

‎R/synLFQ3.R

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#'
33
#' @title Synthetic length frequency data III
44
#'
5-
#'
65
#' @description Synthetic length frequency data from Sparre & Venema (1998). Can be
76
#' used for the estimation of the instantaneous total mortality rate (Z) by means
87
#' of \code{\link{Z_BevertonHolt}}.

‎R/synLFQ4.R

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#'
33
#' @title Synthetic length-frequency data IV (with seasonal oscillation)
44
#'
5-
#'
65
#' @description Synthetic length-frequency data as generated by the function
76
#' \code{lfqGen} from the \emph{fishdynr} package (Taylor 2016). Can be used by
87
#' \code{\link[TropFishR]{ELEFAN}} or \code{\link[TropFishR]{ELEFAN_SA}}.

‎R/synLFQ5.R

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#'
33
#' @title Synthetic length-frequency data V (without seasonal oscillation)
44
#'
5-
#'
65
#' @description Synthetic length-frequency data as generated by the function
76
#' \code{lfqGen} from the \emph{fishdynr} package (Taylor 2016). Can be used by
87
#' \code{\link[TropFishR]{ELEFAN}} or \code{\link[TropFishR]{ELEFAN_SA}}.

‎R/synLFQ6.R

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#'
33
#' @title Synthetic length-frequency data VI (without seasonal oscillation)
44
#'
5-
#'
65
#' @description Synthetic length-frequency data as generated by the function
76
#' \code{lfqGen} from the \emph{fishdynr} package (Taylor 2016). Can be used by
87
#' \code{\link[TropFishR]{ELEFAN}} or \code{\link[TropFishR]{ELEFAN_SA}}.

‎R/synLFQ7.R

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#'
33
#' @title Synthetic length-frequency data VII with seasonal oscillation
44
#'
5-
#'
65
#' @description Synthetic length-frequency data as generated by the function
76
#' \code{lfqGen} from the \emph{fishdynr} package (Taylor 2016). Can be used by
87
#' \code{\link[TropFishR]{ELEFAN}}, \code{\link[TropFishR]{ELEFAN_SA}}, or

‎R/synLFQ8.R

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#'
33
#' @title Synthetic length-frequency data VIII with variable harvest rate
44
#'
5-
#'
65
#' @description Synthetic length-frequency data as generated by the
76
#' function \code{virtualPop2} from the \emph{fishdynr} package
87
#' (Taylor and Mildenberger, 2018). Can be used by

‎man/ELEFAN.Rd

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎man/growth_length_age.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎man/plot.Bhattacharya.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.