I would like to do a linear regression using a complex survey. And I need to use replicate weights. I have a dataframe with the data and another with the replicate weights, but I don't know how to proceed.

```
data <- data.frame ("Country" = c ("ESP", "AUT", "POR", "GRE", "ITA", "USA", "FRA", "GER", "DEN", "BRA", "AUS", "CHI"),
var2 = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 10,11),
var3 = c (1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1,0),
var4 = c(501, 700, 71, 800, 801, 71, 81, 91, 91, 80, 71,90),
my_weights = c(14, 10, 11, 10, 18, 17, 18, 19, 10, 10, 17, 11))
replicate.weights <- data.frame (factor1 = c(12, 12, 53, 84, 95, 86, 77, 88, 99, 99, 10,110),
factor2 = c (51, 50, 51, 50, 31, 31, 31, 21, 11, 10, 11,10),
factor3 = c (5, 10, 511, 506, 31, 341, 351, 201, 110, 101, 11,10),
factor4 = c (1, 5, 511, 50, 1, 31, 301, 21, 110, 101, 11,1),
factor5 = c (510, 10, 521, 580, 1, 31, 1, 21, 131, 10, 111,1),
factor6 = c (51, 1, 21, 50, 10, 31, 13, 21, 11, 10, 11,1))
```

When it is only with "conventional" weights I know it is possible to use weigths = my_weights as here:

lm(Y ~ X1+ X2, data = my_data , weights = my_weights)

But if I have two dataframes I don't know how to do it.

I think I need the survey library, but I can't find any example for a linear regression.