[R] HISTOGRAM
Rui Barradas
ruipb@rr@d@@ @ending from @@po@pt
Fri Nov 9 21:25:31 CET 2018
Hello,
You probably want a bar plot, not a histogram.
old.sci <- options(scipen=999)
with(mydata, barplot(number, space = 0, names.arg = name, beside = TRUE))
options(scipen = old.sci)
#-----------------
mydata <- read.table(text = "
name number
ds 6277
lk 24375
ax 46049
dd 70656
az 216544
df 220620
gh 641827
", header = TRUE)
mydata
Hope this helps,
Rui Barradas
Às 18:45 de 09/11/2018, Medic escreveu:
> 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