rggplot2setaveragecurves

R: How can I plot the average curve of a set of curve using ggplot2 in R


I'm relative new in R language and I'm trying to plot the average of a set of curves, for example in the picture below I have 3 curves and I need to plot the average of the 3 curves. What aproximations can I take to solve this?

Graph

My data is structured this way:

All sensors are in a different data frame

The structure of the data frame

Any help is welcome and also if someone has feedback about my question is welcome too, as I'm new in stackoverflow.

Thanks


Solution

  • With your data in dataframe df, with time down rows and Leyenda across columns:

    df$mean <- rowMeans(df[,1:3])
    

    But please do provide an example of your data in future.