I would like to analyze a survey which was analyzed in the past with the SPSS software. The survey has a weight variable.
In SPSS it's easy to weight by variable (with the 'weight by' function) But I have problems while tring to do so with R.
I used the Survay package to include the weight variable. I will show here a more simple example:
    Data <- data.frame(
    X =c(1,4,6,4,1,7,3,2,2),
    Y = c(6,5,9,9,43,65,45,67,90),
    weight=c(0.1,1.2,4,0,0,5,0.65,1,0)
    )
    summary(Data )
      X               Y             weight     
 Min.   :1.000   Min.   : 5.00   Min.   :0.000
 1st Qu.:2.000   1st Qu.: 9.00   1st Qu.:0.000
 Median :3.000   Median :43.00   Median :0.650
 Mean   :3.333   Mean   :37.67   Mean   :1.328
 3rd Qu.:4.000   3rd Qu.:65.00   3rd Qu.:1.200
 Max.   :7.000   Max.   :90.00   Max.   :5.000
    library(survey)
    dat_weight=svydesign(ids = ~1, data = Data , weights = Data $weight)
Now I would like to save this object (dat_weight) as a simple data frame and use it for other analyses (such as PCA, CA, and so on).
Can it be done?
 
     
    