[R] HISTOGRAM

Rick Bilonick r@bilonick @ending from gm@il@com
Sat Nov 10 01:25:52 CET 2018


First, a histogram would not be appropriate (your data appear to be
categorical - a histogram is for continuous numeric vales) - you would need
a bar plot. You should make two vectors (one for the category names and the
other for the frequencies) and use the barplot function.

On Fri, Nov 9, 2018 at 1:46 PM Medic <mailiPadpost using gmail.com> wrote:

> What would be the correct code (simplest version) (without gplot())
> for histogram (with 7 bars), which would include 7 names of bars under
> the X-axis. The data are:
>
> name number
> ds    6277
> lk     24375
> ax    46049
> dd    70656
> az    216544
> df     220620
> gh    641827
>
> (I'm attaching mydata.r, making with dput.)
>
> My attempt is:
>
> options(scipen=999)
> with (mydata, hist(number))
>
> P.S. I can't understand how the column "name" to include in a code
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=02%7C01%7Crab45%40pitt.edu%7C55f2571738b246f9dc1e08d646739b27%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C636773859721875419&sdata=haHuxll2%2FO0Dci0fSpd0evjfi0MTmLi0JoghvHxlz3o%3D&reserved=0
> PLEASE do read the posting guide
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.R-project.org%2Fposting-guide.html&data=02%7C01%7Crab45%40pitt.edu%7C55f2571738b246f9dc1e08d646739b27%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C636773859721875419&sdata=aL6arSyKx4m9LBdOMhdhSpsdJmGCHubfdI%2Fns4Rgytw%3D&reserved=0
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list