[R] Average of several line plots
Eduardo de Oliveira Horta
eduardo.oliveirahorta at gmail.com
Wed Feb 2 20:07:12 CET 2011
It is not clear from your message whether these data represent
functions or such. Could you perhaps bring up an example?
I'm guessing each data set contains evaluation points and function
values at those points, and that you would like to plot these
functions and the mean function all on the same graph, is that right?
If the points in the domain differ from each other, it's not as
immediate to build a mean function. A quick recipe would be to use
splinefun on each data set, generate a new grid for the domain,
evaluate each obtained spline on this grid to get new data sets and
build the mean function from there.
But without an example it's really just guessing. Hope this helps anyway.
?splinefun
Best regards,
Eduardo
On Wed, Feb 2, 2011 at 2:44 PM, mattnixon <m.r.nixon at ex.ac.uk> wrote:
>
> Hi,
>
> I have several data sets which are all approximately within the same values
> as each other (both X and Y) and all of these data sets more or less overlap
> each other when plotted on the same graph. However, although each data set
> varies between approximately the same range, there are vastly different
> numbers of data points within each data set (due to the nature of how these
> values had to be measured).
>
> Currently, I am trying to figure out a way to produce a graph showing all
> these data sets and a line showing the average of all of the data sets.
> Given the different number of data points, I can't think of an easy way to
> do this.
>
> Can anybody help?
>
> Thanks!
> --
> View this message in context: http://r.789695.n4.nabble.com/Average-of-several-line-plots-tp3254850p3254850.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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