A set of R functions for analyzing cohort studies with time-varying exposures