<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
On 10/18/2011 12:02 PM, Laurie wrote:
<blockquote cite="mid:4E9D4EBD.60305@gmail.com" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
On 10/18/2011 11:41 AM, <a moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="mailto:ernesto.jardim@jrc.ec.europa.eu">ernesto.jardim@jrc.ec.europa.eu</a>
wrote:
<blockquote cite="mid:4E9D49C3.6010602@jrc.ec.europa.eu"
type="cite">On 10/18/2011 11:26 AM, Laurie wrote: <br>
<blockquote type="cite">I am working on tagging models, where
tags are released for a number of years and then recaptured
in subsequent years. This allows M & Z to be estimated
along a cohort. <br>
<br>
The data are in the form of number of fish tagged and
recovered each year of a cohort. This means that you can´t use
FLCohort which has age & cohort as dims 1&2. <br>
<br>
However, if you use the 1st dim for cohort then you can model
this with an FLQuant, i.e. <br>
<br>
library(plyr) <br>
<br>
setGeneric("I", function(object,...) <br>
standardGeneric("I")) <br>
setGeneric('O', function(object, ...) <br>
standardGeneric("O")) <br>
<br>
setMethod('I', signature(object='FLQuant'), <br>
function(object,...){ <br>
dmns <-dimnames(object) <br>
dmns[[1]]
<-ac((dims(object)$minyear-dims(object)$max):(dims(object)$maxyear-
dims(object)$min)) <br>
names(dmns)[1]<-"quant" <br>
flc <-FLQuant(NA,dimnames=dmns) <br>
<br>
t. <-as.data.frame(object) <br>
t.$cohort <-t.$year-t.$age <br>
flc[]
<-daply(t.,c("cohort","year","unit","season","area","iter"),function(x)
sum(x$data)) <br>
<br>
return(flc)}) <br>
<br>
setMethod('O', signature(object='FLQuant'), <br>
function(object,...){ <br>
dmns <-dimnames(object) <br>
dmns[[1]]
<-ac((dims(object)$maxyear-dims(object)$max):(dims(object)$minyear-dims(object)$min))<br>
names(dmns)[1]<-"age" <br>
flc <-FLQuant(NA,dimnames=dmns) <br>
<br>
t. <-as.data.frame(object) <br>
t.$age <-t.$year-t.$quant <br>
t. <-t.[!is.na(t.$data),] <br>
flc[]
<-daply(t.,c("age","year","unit","season","area","iter"),function(x)
sum(x$data)) <br>
<br>
return(flc)}) <br>
<br>
data(ple4) <br>
<br>
m1=I(m(ple4)) <br>
m2=O(m1) <br>
<br>
It is probably best to derive a new class for this object just
to break VPAs etc. But what to call it? Also how does it
relate to FLCohort. <br>
Laurie <br>
</blockquote>
<br>
You may change the age in FLCohort <br>
<br>
library(FLCore) <br>
data(ple4) <br>
flc <- FLCohort(catch.n(ple4)) <br>
quant(flc) <- "year" <br>
<br>
why not using year in the first dimension ? it should work out
of the box. <br>
<br>
EJ <br>
<br>
<br>
</blockquote>
But you don´t get what you want.<br>
<br>
<span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: Arial; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: 2; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="font-family: Monospace;
font-size: 13px; line-height: 17px; white-space: pre-wrap;"><br>
<pre tabindex="0" class="GD40030CKR" style="font-family: Monospace; font-size: 10pt ! important; outline-style: none; border-style: none; white-space: pre-wrap ! important; margin: 0px; line-height: 1.3;"><span class="GD40030CBR ace_keyword" style="color: blue;">I(m(ple4))[1:10,1:10]
</span>An object of class "FLQuant"
, , unit = unique, season = all, area = unique
year
quant 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966
1947 0.1 NA NA NA NA NA NA NA NA NA
1948 0.1 0.1 NA NA NA NA NA NA NA NA
1949 0.1 0.1 0.1 NA NA NA NA NA NA NA
1950 0.1 0.1 0.1 0.1 NA NA NA NA NA NA
1951 0.1 0.1 0.1 0.1 0.1 NA NA NA NA NA
1952 0.1 0.1 0.1 0.1 0.1 0.1 NA NA NA NA
1953 0.1 0.1 0.1 0.1 0.1 0.1 0.1 NA NA NA
1954 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 NA NA
1955 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 NA
1956 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
units: NA
<span class="GD40030CNR ace_keyword" style="white-space: pre; color: blue;">> </span><span class="GD40030CBR ace_keyword" style="color: blue;">FLCohort(m(ple4))[1:10,1:10]
</span>An object of class "FLCohort"
, , unit = unique, season = all, area = unique
cohort
age 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956
1 NA NA NA NA NA NA NA NA NA 0.1
2 NA NA NA NA NA NA NA NA 0.1 0.1
3 NA NA NA NA NA NA NA 0.1 0.1 0.1
4 NA NA NA NA NA NA 0.1 0.1 0.1 0.1
5 NA NA NA NA NA 0.1 0.1 0.1 0.1 0.1
6 NA NA NA NA 0.1 0.1 0.1 0.1 0.1 0.1
7 NA NA NA 0.1 0.1 0.1 0.1 0.1 0.1 0.1
8 NA NA 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
9 NA 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
laurie</pre>
</span></span></blockquote>
<br>
Lost me. What do you want ?<br>
<br>
EJ<br>
<br>
<br>
<br>
</body>
</html>