Learn R Programming

mmpf (version 0.0.5)

makeDesign: make a uniform, random, or user-specified grid over some columns of a data.frame, and combine it with a grid of points to integrate over.

Description

makes a uniform, random, or user-specified grid over some columns of a data.frame and takes their Cartesian product with the other columns

Usage

makeDesign(data, vars, n, uniform = TRUE, points, int.points)

Arguments

data

a data.frame which must contain vars as well as at least one other column

vars

character vector the columns in data to create the grid for

n

two dimensional integer vector giving the resolution of the grid. the first element gives the grid on vars and the second on the other columns, which are sampled without replacement.

uniform

logical, indicates whether a uniform grid is to be constructed.

points

a named list which gives specific points for vars.

int.points

a integer vector giving indices of the points in data to marginalize over.

Value

a data.frame with at most n dimensions.

Examples

Run this code
# NOT RUN {
data = data.frame(w = seq(0, 1, length.out = 5),
  x = factor(letters[1:5]),
  y = ordered(1:5),
  z = 1:5,
  r = letters[1:5],
  stringsAsFactors = FALSE)
makeDesign(data, "z", c(10, 5), TRUE)

# }

Run the code above in your browser using DataLab