[R] binning by frequency
Rui Barradas
ruipbarradas at sapo.pt
Tue Nov 27 16:49:09 CET 2012
Hello,
I'm not sure I ubderstand but,
h <- hist(b1,brea=100)
which.max(h$counts) # max frequency
findInterval(b1, h$breaks)
Hope this helps,
Rui Barradas
Em 27-11-2012 14:59, Santosh escreveu:
> Dear Rxperts,
>
> is there way to identify intervals from continuous data (having some kind
> of a pattern) and then pick the value of most frequency?
>
>
> a1 <- round(rnorm(50,mean=0,0.1),2)
> a2 <- round(rnorm(50,mean=1,0.2),1)
> a3 <- round(rnorm(50,mean=5,1),0)
> a4 <- round(rnorm(50,mean=14,4),0)
> a5 <- round(rnorm(50,mean=30,8),0)
>
> b1 <- rbind(a1,a2,a3,a4,a5)
>
> hist(b1,brea=100) # shows intervals and values with varying frequency.
>
> unlike the mean values of a1.... a5 above, I don't know the nominal values.
> I would like an algorithm to identify intervals and pick the value with
> most frequency.
>
> I tried "cut", "split" and was not successful.
> Any suggestions/tips are highly welcome.
> Thanks and regards,
> Santosh
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list