[R] Average curve in R

arun smartpink111 at yahoo.com
Sat Jun 2 04:47:05 CEST 2012


Hi Qamar,

I guess you are looking for row means vs. days plot.

If that is the case, try this:
datQ<-cbind(c(6,5,6,7,4,3,5),c(2,4,35,32,4,6,6),c(2,4,2,3,423,4,5),c(2,3,13,5,3,5,3))

datQmean<- apply(datQ,1,mean)
[1]   3.00   4.00  14.00  11.75 108.50   4.50   4.75
datQmean<-data.frame(datQmean)
 days<-c(1:7)

datQplot<-data.frame(datQmean,days)
plot(datQmean~days,data=datQplot,type="l")

A.K.







----- Original Message -----
From: QAMAR MUHAMMAD UZAIR <d029307 at polito.it>
To: r-help at r-project.org
Cc: 
Sent: Friday, June 1, 2012 5:31 PM
Subject: [R] Average curve in R

Dear R users,
l
I have weekly data in the following manner

[,1]    [,2]    [,3]    [,4]
6    2    2    2
5    4    4    3
6    35    2    13
7    32    3    5
4    4    423    3
3    6    4    5
5    6    5    3

I drew curve of each column against days (1,2,3,4,5,6,7). Now I want to draw an average curve (a representative curve) of the whole data. Is there a way in R to perform such operation? please reply ASAP as i have an assignment to submit on monday.
Thanks in Advance..
regards

______________________________________________
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