R 3.1.0, table(x,y) function on Window 8.1, situation with the tabulation -
R 3.1.0, table(x,y) function on Window 8.1, situation with the tabulation -
i'm looking situation when seek tabulate result function table(x,y), example, creating table next code:
set.seed(150) rr01<-rep(sample(1:100,100),10) rcut<-cut(rr01,quantile(rr01)) rr<-data.frame(sample=rr01,cut=rcut) rrtable<-table(rr$cut,rr$sample) the first value of tabulated table (1,1) zero, happen kind of tables, result of first value zero, although value should count times first value appear in first group, in case 10
how can prepare it?
thank you
you can create cut include left endpoint include.lowest option:
set.seed(150) rr01<-rep(sample(1:100,100),10) rcut<-cut(rr01,quantile(rr01), include.lowest=true) rr<-data.frame(sample=rr01,cut=rcut) rrtable<-table(rr$cut,rr$sample) rrtable # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 # [1,25.8] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 # (25.8,50.5] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # (50.5,75.2] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # (75.2,100] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # ... r table
Comments
Post a Comment