[R] frequency distribution in figures....

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Sat Sep 8 12:43:42 CEST 2018


On 08/09/2018 6:25 AM, akshay kulkarni wrote:
> dear members,
>                               I am facing difficulties in plotting histograms in R in Linux CLI.
> 
> Is there a function in R which produces a table of frequency distribution in figures rather than plot that distribution?
> 
> Something like this:
> 
> xht <- c(1,2,3,4,5,6,7,8,9,10)
> 
> required table:
>                                bins:                   1-2     3-4    5-6     7-8     9-10
>                                frequency:          2          2       2         2        2
> 
> Also is this possible:
> 
> xhth <- hist(xht)
> summary(xhth)
> 

You could use

table(cut(xht, breaks=2*(0:5)))

which produces


  (0,2]  (2,4]  (4,6]  (6,8] (8,10]
      2      2      2      2      2

for your dataset.

Duncan Murdoch




More information about the R-help mailing list