Pass optional arguments to function, three dots
问题 I'm confused how ... works. tt = function(...) { return(x) } Why doesn't tt(x = 2) return 2 ? Instead it fails with the error: Error in tt(x = 2) : object 'x' not found Even though I'm passing x as argument ? 回答1: Because everything you pass in the ... stays in the ... . Variables you pass that aren't explicitly captured by a parameter are not expanded into the local environment. The ... should be used for values your current function doesn't need to interact with at all, but some later