R uses lexical scoping, a concept inherited from the Scheme language. This means the values of free variables in a function are resolved by finding them in the environment where the function was defined, not the environment where it is called. This makes function behavior more predictable and independent of the calling context, a key feature for functional programming.
