The need comes from the PISA data. (http://www.pisa.oecd.org)

In the data there are many cases and each of them carries a numeric
variable that signifies it's weight.
In SPSS the command would be "WEIGHT BY"

In simpler words here is an R sample ( What is get  VS  what i want to get )


> data.recieved <- data.frame(
+ kindergarten_attendance = factor(c(2,1,1,1), labels = c("Yes", "No")),
+ weight=c(10, 1, 1, 1)
+ );
> data.recieved;
  kindergarten_attendance weight
1                      No     10
2                     Yes      1
3                     Yes      1
4                     Yes      1
>
>
>
> data.weighted <- data.frame(
+ kindergarten_attendance = factor(c(2,2,2,2,2,2,2,2,2,2,1,1,1), labels =
c("Yes", "No")) );
>
>
> par(mfrow=c(1,2));
> plot(data.recieved$kindergarten_attendance,main="What i get");
> plot(data.weighted$kindergarten_attendance,main="What i want to get");
>

tnx in advance
Hed

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to