Hope everyone is well. I have an embarrassingly easy question here, in that I can't figure out how to use the return() correctly in my dead simple example. Say I have a dummy R script called dummy.R saved in the local directory with
dummy<-function(a,b){
result=a+b
return(result)
}
However, in my Rstudio, when I call this function, I just don't see result object appearing in my global environment at all.
Can anyone enlighten me as to what am I neglecting or doing wrong?
How are you calling the function? If you run it with two arguments in the RStudio console, do you not get any return statement?
Also, note that if you want to show the return value while assigning the value to an object, use parentheses.