[R] HISTOGRAM

Jim Lemon drjimlemon @ending from gm@il@com
Sat Nov 10 10:45:38 CET 2018


Hi Medic,
Perhaps this:

medic_df<-read.table(text="name number
ds    6277
lk     24375
ax    46049
dd    70656
az    216544
df     220620
gh    641827",
header=TRUE)
library(plotrix)
options(scipen=10)
barp(medic_df$number,names.arg=medic_df$name,width=0.5)

As others have noted, this is really a barplot with no spaces between the bars.

Jim
On Sat, Nov 10, 2018 at 5:46 AM 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://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