I was helping a friend of mine with some of his code. I didn't know how to explain the strange behavior, but I could tell him that his functions weren't explicitly returning anything. Here is a minimum reproducible example:
derp <- function(arg){
arg <- arg+3
}
data <- derp(500)
data
#[1] 503
derp(500)
#nothing outputs
class(derp(500))
#[1] "numeric"
Is there a name for this that I can google? Why is this happening? Why isn't arg being destroyed after the call to derp() finishes?