Re: [R] Using Weights in R

2011-02-17 Thread Phil Spector
Well, if you really want to produce what SAS does: ageval = read.table(textConnection('AgeCat FINWT + 1 98 + 2 62 + 1 75 + 3 39 + 4 28 + 2 47 + 2 66 + 4 83 + 1 19 + 3 50 + '),header=TRUE) one = aggregate(ageval$FINWT,ageval['AgeCat'],sum) two = prop.table(as.table(one$x)) * 100 three = cumsum(

[R] Using Weights in R

2011-02-17 Thread Krishnan Viswanathan
I am new to R. I have a data set like this (given below is a fictional dataset): AgeCat FINWT 1 98 2 62 1 75 3 39 4 28 2 47 2 66 4 83 1 19 3 50 I need to calculate the weighted distribution of the variable AgeCat. In SAS i can do: proc freq data=ageval; tables agecat; weight finwt; run; Wha