Skip to content

Commit b2f2486

Browse files
author
Dhairya Jain
committed
Prevented returning fitted object after plotting
The function returned fitted object after plots = TRUE. This caused the console to print that object, which results in an annoying "calls" information. Now it will just print NULL. Signed By: Dhairya Jain <jaindhairya2001@gmail.com>
1 parent a108bb9 commit b2f2486

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

R/SFM.fit.models.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ SFM.fit.models <- function(Ra, Rb, Rf=0, family = "mopt",
6868
# option is that program will ask you to choose a plot
6969
# plots: Boolean to output plots after the function. Defaults to TRUE
7070
# Output:
71-
# Optional Graphs comparing models, and returns a fitted object
71+
# Graphs comparing models, If plots = TRUE is used
72+
# A fitted object, If plots = FALSE is used
7273

7374
# FUNCTION:
7475

@@ -107,7 +108,7 @@ SFM.fit.models <- function(Ra, Rb, Rf=0, family = "mopt",
107108
# Fit both the models
108109
fmLSrob <- fit.models::fit.models(LSFit, RobFit)
109110

110-
# Plot the fit.models object if asked
111+
# Plot the fit.models object if asked and function will return nothing
111112
if (plots==TRUE){
112113
if(is.null(which.plots)){
113114
plot(fmLSrob, which.plots = "ask") # ask = 0 to exit
@@ -117,6 +118,8 @@ SFM.fit.models <- function(Ra, Rb, Rf=0, family = "mopt",
117118
}
118119
}
119120

120-
# Return the fitted object to the user
121-
return(fmLSrob);
121+
else{
122+
# Return the fitted object to the user
123+
return(fmLSrob);
124+
}
122125
}

0 commit comments

Comments
 (0)