#' von Bertalanffy growth
#'
#' Calculate size after a given time interval using the Faben's reformulation of the von Bertalanffy formula
#'
#' @param A (numeric) Asymptotic body size (can be calculated in \code{calc.growth()})
#' @param k (numeric) Growth rate (can be calculated in \code{calc.growth()})
#' @param size1 (numeric vector) Initial body size (should be in the same units used to calculate A and k)
#' @param td (numeric vector) Time since \code{size1} (should be in the same units used to calculate A and k)
#' @return Vector of expected size(s) after the time interval(s) specified in \code{td}
#'
#' @details
#' It takes a vector of initial sizes, vector of amounts of time since those sizes were measured, and A and k from \code{calc.growth(model="vb")} and returns the expected body sizes after the specified time intervals.
#'
#' \strong{Note}: If size1 > A, the resulting size estimate will be less than size1
#'
#' @examples
#' #For this example, assume size is in mm and time is in years
#' #calculate expected sizes of individuals that are 200 and 300 mm after 2 and 1.5 years, respectively
#' vb(A = 403.7077,
#'  k = 0.1365507,
#'  size1 = c(200,300),
#'  td = c(2,1.5))
#'
#' @references
#' von Bertalanffy, L. (1957). Quantitative laws in metabolism and growth.
#' \emph{The Quarterly Review of Biology}, 32, 217-231.
#'
#' Fabens, A.J. (1965). Properties and fitting of the von Bertalanffy growth curve.
#' \emph{Growth}, 29, 265-289.
#'
#' @export
vb<- function(A,k, size1,td){
  size2 <- A-(A-size1)*exp(-k*td)
  size2}
