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]]
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
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 <akshay_e4 at hotmail.com> 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]] > > ______________________________________________ > R-help at r-project.org 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.