R/code.R

#' @title Function \code{wrapper_function}
#' @description Wrapper function to call generate_data. \code{wrapper_function}
#' tests if \code{remake} keeps track of changes to nested functions.
#' @export
#' @return result of gendata
wrapper_function = function(){
  generate_data()
}

#' @title Function \code{generate_data}
#' @description Generates some data.
#' @export
#' @return an unprocessed data frame
generate_data = function(){
  data(mtcars)
  n = dim(mtcars)[1]
  mtcars$cyl = rpois(n, 5) # COMMENT/UNCOMMENT THIS LINE TO SEE HOW remake::make() RESPONDS
  write.csv(mtcars, file = "data.csv")
}

#' @title Function \code{process_data}
#' @description Process some data generated by \code{generate_data}.
#' @export
#' @return data frame
#' @param filename file name of csv data
process_data = function(filename){
  d = read.csv(filename)
  data.frame(x = d$mpg, y = d$cyl)
}

#' @title Function \code{myplot}
#' @description make a plot
#' @export
#' @return plot
#' @param data data frame with fields x and y
myplot = function(data){
  plot(y~x, data = data)
}
wlandau/remakeInPackage documentation built on May 4, 2019, 8:45 a.m.