knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-figs/",
  cache.path = "README-cache/"
)

ggrowth

library(ggrowth)

Load the dataset that comes with the package (for illustration, this includes data for 2 individuals).

data("ggrowthData") # load data
growthData$ID = as.factor(growthData$ID)

Fit the gompertz model to the dataset

fit = fit_gompertz(growthData)

Make a plot of the predicted values

ggplot(fit, aes(Jday, predict, group=ID, color=ID)) + geom_line() +
  geom_point(aes(Jday, Weight)) + xlab("Time") + ylab("Predicted weight")

Figure

Adding new data

New data can be added in as a new data frame, or rbind() to the existing data frame. The format is

head(growthData)


eric-ward/ggrowth documentation built on May 16, 2019, 8:26 a.m.