[Ipmpack-users] Problem with makeGrowthObj, makeSurvObj
Chantal Hutchison
chantallana at gmail.com
Mon Mar 6 22:04:42 CET 2017
Hello,
I have the following code
sizeNext<-c(log(ba1HC_tplus1),log(ba3HC_tplus1),log(ba6HC_tplus1)) #ADD IN
DATA FOR sizeNEXT
size<-c(log(ba1HC_t),log(ba3HC_t),log(ba6HC_t)) #ADD IN DATA FOR SIZE
covariate<-c(rep(1,length(ba1HC_t)),rep(3,length(ba3HC_t)),rep(6,length(ba6HC_t)))
#DIVERSITY IS A COVARIATE
surv<-c(1:length(sizeNext))
#SET THE SURVIVAL VALUES
for(i in 1:length(sizeNext)){
if(is.na(sizeNext[i])==TRUE){
surv[i]=0
} else {
surv[i]=1
}
}
#MAKE A DATAFRAME
dff<-data.frame(size,sizeNext,surv,covariate)
dff<-dff[!is.na(dff$size),]
dff<-dff[!is.infinite(dff$size),]
dff<-dff[!is.infinite(dff$sizeNext),]
Then I try to use:
gr<-makeGrowthObj(dataf=dff,Formula=sizeNext~size+covariate)
sv<-makeSurvObj(dataf=dff,Formula=surv~size+covariate)
However this returns under gr coefficients, for example: (intercept), size,
covariate2, and covariate3. Why am I getting covariate2 and covariate3 when
I just want a column for covariate?
Thanks for your help!
Chantal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/ipmpack-users/attachments/20170306/79c843dd/attachment.html>
More information about the IPMpack-users
mailing list