E.g:
MP_PPD = function(x, Data, reps=1, nyrs, outfile= NA){
lastyr = match(Data@LHYear, Data@Year)
pyr = length(Data@Year) - lastyr
if(pyr > nyrs){
if(is.na(outfile)) outfile= paste0(getwd(), "/PPD.rda")
saveRDS(Data, outfile)
print(paste0("PPD written to ", outfile))
stop()
} # end of save PPD
FMSYref(x, Data, reps) # default advice
}
class(MP_PPD) = 'MP'
where the user can just adjust outfile and nyrs as they like
formals(MP_PPD)$nyrs = 10
formals(MP_PPD)$outfile = "C:/temp/MSEstuff/myPPD.rda"