Values & References1 / 8
Up next

Arguments are copied

modify <- function(v) {
  # this changes only the local copy
  v[1] <- 99
  v
}
x <- c(1, 2, 3)
modify(x)
# x is unchanged by the call
print(x)
What you're solving

a function edits a local copy