I often use the survey package to deal with the complex survey data in R. I know using the function weights() can extract the weights from the survey design object. I want to understand the process behind this function. Does it consider the design of this complex survey?
I find that looking at the help(svydesign) example helped me to understand at least where the weight argument comes from—it's in the data object. So the weights argument here has to come from api because nothing else is in scope. After data(api) it appears that there are four objects brought into scope and apistrat is one of them and that supplies the data argument.
The other arguments must derive from apistrat because nothing by their names are yet in namespace. So, I look with apistrat() and find them. Why those particular values I have no idea; that's a domain question.