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)
a function edits a local copy