R/plotSexRatio.fn.R

plotSexRatio.fn <-
function(len,fn=median,circleSize=0.1,...) {
    ratioF <- len$NumF/(len$NumF+len$NumM)
    yF <- lapply(split(ratioF,floor(len$Length)),fn,na.rm=TRUE)
    x <- names(split(ratioF,floor(len$Length)))
    nobs <- unlist(lapply(split(ratioF,floor(len$Length)),length))
    plot(x,yF,type="l",col="red",xlab="Length (cm)",ylab="Fraction female",...)
    symbols(x,yF,circles=nobs,inches=circleSize,fg="red",bg=rgb(1,0,0,alpha=0.5),add=T)
    return(invisible(data.frame(length=x,fraction.female=as.numeric(yF))))
}

Try the nwfscSurveyCode package in your browser

Any scripts or data that you put into this service are public.

nwfscSurveyCode documentation built on May 2, 2019, 5:27 p.m.