data_lim | R Documentation |
Truncate variables in a numeric matrix data
to specified limits. This function was designed to be used after running bamExtras::data_polate
, to limit life history variables to realistic values after linear extrapolation.
data_lim(data, xname = NULL, xlim = c(-Inf, Inf))
data |
a numeric matrix or data frame that can be coerced to a numeric matrix |
xname |
column names of variables to truncate |
xlim |
numeric vector of length 2 with upper and lower limits to trim |
Nikolai Klibansky
## Not run:
rdat <- standardize_rdat(rdat_RedGrouper)
mydata <- rdat$a.series
mydata2 <- data_polate(mydata,xout=0:max(mydata$age))
mydata3 <- data_lim(mydata2,xlim=c(0,Inf))
out <- data_lim(mydata3,xname=c("prop.female","prop.male","mat.female","mat.male"),xlim=c(0,1))
par(mfrow=c(1,1))
for(i in colnames(out[,-1])){
x <- mydata[,1]
xout <- out[,1]
yout_i <- out[,i]
plot(xout,yout_i,ylab=i)
points(x,mydata[,i],col="red",pch=16)
readline(prompt="Press [enter] to continue")
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.