Re: [R] Including percentage values inside columns of a histogram

2021-08-16 Thread Paul Bernal
Thank you very much Mr. Gunter, I will give it a try. Cheers, Paul El lun., 16 de agosto de 2021 7:49 p. m., Bert Gunter < bgunter.4...@gmail.com> escribió: > I may well misunderstand, but proffered solutions seem more complicated > than necessary. > Note that the return of hist() can be saved

[R] Sectors covered by the Nearest Neighbors

2021-08-16 Thread Eliza Botto
deaR useRs, I have a very basic question. I am for putting up a real long text. But I tried searching for some clues in the previous help posts but unfortunately, I could get any. I have the following data called "el". > dput(el) structure(c(1.00451374640952, 1.88100123102175, 0.20188756668034

Re: [R] Including percentage values inside columns of a histogram

2021-08-16 Thread Bert Gunter
I may well misunderstand, but proffered solutions seem more complicated than necessary. Note that the return of hist() can be saved as a list of class "histogram" and then plotted with plot.histogram(), which already has a "labels" argument that seems to be what you want. A simple example is" dat

Re: [R] Including percentage values inside columns of a histogram

2021-08-16 Thread Paul Bernal
Dear Jim, Thank you so much for your kind reply. Yes, this is what I am looking for, however, can´t see clearly how the bars correspond to the bins in the x-axis. Maybe there is a way to align the amounts so that they match the columns, sorry if I sound picky, but just want to learn if there is a

Re: [R] Including percentage values inside columns of a histogram

2021-08-16 Thread Jim Lemon
Hi Paul, I just worked out your first request: datasetregs<-<-structure(list(Date = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L

Re: [R] Including percentage values inside columns of a histogram

2021-08-16 Thread Paul Bernal
This is way better, now, how could I put the frequency labels in the columns as a percentage, instead of presenting them as counts? Thank you so much. Paul El lun, 16 ago 2021 a las 17:33, Rui Barradas () escribió: > Hello, > > You forgot to cc the list. > > Here are two ways, both of them appl

Re: [R] Including percentage values inside columns of a histogram

2021-08-16 Thread Rui Barradas
Hello, You forgot to cc the list. Here are two ways, both of them apply hist() and text() to Amount split by Date. The return value of hist is saved because it's a list with members the histogram's bars midpoints and the counts. Those are used to know where to put the text labels. A vector l

Re: [R] Including percentage values inside columns of a histogram

2021-08-16 Thread Rui Barradas
Hello, The function Hist comes from what package? Are you sure you don't want a bar plot? agg <- aggregate(Amount ~ Date, datasetregs, sum) bp <- barplot(Amount ~ Date, agg) with(agg, text(bp, Amount/2, labels = Amount)) Hope this helps, Rui Barradas Às 22:54 de 16/08/21, Paul Bernal escre

[R] Including percentage values inside columns of a histogram

2021-08-16 Thread Paul Bernal
Hello everyone, I am currently working with R version 4.1.0 and I am trying to include (inside the columns of the histogram), the percentage distribution and I want to generate three histograms, one for each fiscal year (in the Date column, there are three fiscal year AF 2017, AF 2020 and AF 2021)