I have a dataframe with part of the NHANES dataset (which is a complex survey) and a weights to apply on it. A screenshot of part of the dataframe and the weights are shown below:
People are represented by SEQN variable. I want a new dataframe with repeated people which represents the weighted dataframe. An example of it (got in NHANES R package) is shown below:
Variables are different in this new dataset, but I put it here just to illustrate what I want: you can notice that person with SEQN = 51624 is repeated three times in the weighted dataset. How should I apply weights to get a dataframe like this one to my dataset? I've already tried R survey package, as described here. The problem is that the method 'svydesign' gives an object from class 'survey.design'. As long as I understand, this object represents the weighted dataset but it can only be used inside methods from 'survey' package (for example, the method 'svyglm', which does linear regression). But what we want is the weighted dataframe, like the one I showed here.
Thanks in advance!