[R] [FORGED] Re: bar plot add space to group data

Peter Langfelder peter@|@ng|e|der @end|ng |rom gm@||@com
Sun Aug 19 17:51:13 CEST 2018


On Sun, Aug 19, 2018 at 7:15 AM <citc using disroot.org> wrote:
>
> August 19, 2018 4:58 AM, "Peter Langfelder" <peter.langfelder using gmail.com> wrote:
>
> > To the OP, try formatting the data to be plotted as a matrix, not as a
> > vector
>
> CSV data provided in a previous message; is not the data formatted as a matrix?

I meant the data you give to barplot - your code supplies only the
third column of the data frame, so barplot only sees a vector. I would
try something like

plotData = do.call(cbind, tapply(csv.data$percentage, csv.data$year, identity))

barplot(plotData, <rest of your argument>)

Peter




More information about the R-help mailing list