frequency distribution in figures....

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

frequency distribution in figures....

akshay kulkarni
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)

very many thanks for your time and effort....
yours sincerely,
AKSHAYM KULKARNI


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: frequency distribution in figures....

Duncan Murdoch-2
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

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: frequency distribution in figures....

Jim Lemon-4
In reply to this post by akshay kulkarni
Hi Akshay,
Try this:

table(cut(xht,breaks=seq(0,10,by=2)))

Jim

On Sat, Sep 8, 2018 at 8:26 PM akshay kulkarni <[hidden email]> 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)
>
> very many thanks for your time and effort....
> yours sincerely,
> AKSHAYM KULKARNI
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.