R/build_grid_helpers.R

Defines functions build_grid build_grid_seed_onedim

# 
# Helpers for grid building
# 
# 
# 
# Builds the grid, dispatching to the right function depending on provided
# grid type.
build_grid <- function(grid_type, coords, npts, pad, grid_opts) {
  
  grid.genfun.name <- paste0('build_grid_', grid_type)
  
  grid.genfun <- get(grid.genfun.name)
  return(as.data.frame(grid.genfun(coords, npts, pad, grid_opts)))
}

# Builds a set of equally-spaced points, taking pad into account. 
# This function is used internally by other grid-building functions.
build_grid_seed_onedim <- function(col, range, npts, pad) {
  seq(min(range[ ,col]) - pad, max(range[ ,col]) + pad, length.out = npts) 
}

Try the rollply package in your browser

Any scripts or data that you put into this service are public.

rollply documentation built on May 30, 2017, 8:07 a.m.