Thursday, 21 May 2015

How to find frequency, cummulative frequency, percent  and cumulative percent using R-console:

Ex.
> var1=c(23,26,24,25,26,23,26,25,25,27,24,24,22,22)
> freq=table(var1)
> cumfreq=cumsum(freq)
> pct=freq*100/length(var1)
> cumpct=cumsum(pct)
> cbind(freq, cumfreq,pct,cumpct)
   freq            cumfreq               pct                cumpct
22                    2       2             14.285714       14.28571
23                    2       4             14.285714       28.57143
24                    3       7             21.428571       50.00000
25                    3      10            21.428571       71.42857
26                    3      13            21.428571       92.85714
27                    1      14            7.142857         100.00000

No comments:

Post a Comment