It might help if you say what exactly you are struggling with. Even
better would be to provide code and data using dput() (just for the
data -- copy and paste the code).
If you can write a function to do whatever it is use need on a single
year, then tapply() will be useful for splitting by year, running your
function individually by year, and reaggregating the data. The plyr
package might also be useful in that respect.
Michael
On Fri, Jan 27, 2012 at 2:20 PM, Jeremy Goss <jeremygoss at gmail.com>
wrote:> I am working on directed network data of the following form:
>
>
> Origin farm ? ? ?Destination farm ? ? ?Year
>
> Farm 1 ? ? ? -> ? ? ? Farm 2 ? ? ? ? ? ? ? ?1999
> Farm 1 ? ? ? -> ? ? ? Farm 3 ? ? ? ? ? ? ? ?1999
> Farm 3 ? ? ? -> ? ? ? Farm 2 ? ? ? ? ? ? ? ?2000
> Farm 1 ? ? ? -> ? ? ? Farm 2 ? ? ? ? ? ? ? ?2000
>
>
> I am using the package 'igraph' and I would like to generate and
plot
> (as a function of time) basic annual network statistics (degree,
> diameter, density) without having to subset for each year. I have a
> feeling that I can do this with either the 'loop' or
'apply' function
> but am battling with the coding. Help would be appreciated!
>
> Thanks
>
> ______________________________________________
> 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.