[R] projection.matrix() {popbio} for more than one matrix

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Feb 24 20:04:32 CET 2008



Michelle DePrenger-Levin wrote:
> Hello,
> 
>  
> 
> I am trying to use the projection.matrix( ) function and am following the
> example given. I have my data formatted very similar to the test.census
> example. 
> 
>  
> 
>> str(AsMi05mat)
> 
> `data.frame':   1854 obs. of  6 variables:
> 
>  $ Tag      : num  501 502 503 504 505 506 507 508 509 510 ...
> 
>  $ Year     : int  1995 1995 1995 1995 1995 1995 1995 1995 1995 1995 ...
> 
>  $ Length   : num  34 37 11 24 7 44 4 7 12 20 ...
> 
>  $ Flowering: int  1 1 0 1 0 1 0 0 0 1 ...
> 
>  $ Fruits   : int  22 22 0 89 0 15 0 0 0 0 ...
> 
>  $ Stage    : Factor w/ 5 levels "","Dead","Dormant",..: 4 4 5 4 5 4 5 5 5 4
> ...
> 
>  
> 
> The example data includes three years but only shows how to create a matrix
> from year 1 to 2. I have 13 years of data and would like to automate creating
> all matrices for each pair of years. 
> 
>  
> 
> I tried a for( ) loop but don't know how to assign new names for each matrix
> so end up with only the final comparison (2005 to 2006). I assume an apply( )
> function is the way to go but can't see how to do it. 

Well, we cannot help to improve your code if we have neither, code nor 
data. Please read the posting guide and specify your code. If something 
is wrong in your code, we might be able to help.

Uwe Ligges




>  
> 
> Thanks for any help!
> 
>  
> 
> Michelle
> 
>  
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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