[R] Making shadowed plot of individual profile from Longitudinal data

Jim Lemon jim at bitwrit.com.au
Tue Aug 12 13:46:00 CEST 2008


On Mon, 2008-08-11 at 01:25 -0700, john james wrote:
> Dear R-help,
> 
> I have a longitudinal dataset with about 5,000 subjects. To avoid overly cluttered plot of the individual profile, I want the plot to be shadowed and to randomly select say 100 subjects which will be depicted using darker lines on the plot.
> 
> Kindly guide me through onhow to do this in R.
> 
Hi John,
Depends upon what you mean by "shadowed". I'll assume that you want the
4900 unlucky subjects to be displayed with minimal visibility and the
lucky 100 with maximal visibility. Assume your data matrix is named
"mymat".

luckyones<-sample(1:5000,100)
matplot(mymat[,-luckyones],type="l",col="lightgray",...)
matlines(mymat[,luckyones],col=1)

Jim



More information about the R-help mailing list