Hello folks,
I have a question for the following diagram.
I would like to put a line over the bars that softly shows a "trend" or "average".
Unfortunately, I don't know exactly how it works.
This is the code I used.
The diagram shows the activity of animals photographed with a camera trap.
If I use geom_line(), the diagram only shows the maximum number of animals in a picture (which is 2). But I need the total number added up - like the bars.
With geom_smooth() a mean value is formed, which is unfortunately unusable.
Is SIGS an R dataset in a package? Or your own dataset? We can't reproduce your issue without the data so we either need a reprex that gives us a SIGS dataset or a require/library line to load the package that has SIGS in it.
It appears you have a dataset with number of animals and time data.
But you have not shown us the geom_line command that "fails"
But you also have defined a new statistical method... The softly trend.
I suspect what you mean is a rolling average.
zoo::roll_mean( ). Would be a sensible approach say using 5 minutes