Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

uniformGrid

method to create a uniform grid on a variable


Description

generates an evenly spaced grid given an input vector, matrix, or data.frame which has size length.out.

Usage

uniformGrid(x, length.out)

Arguments

x

a vector, matrix, or data.frame to create a grid on.

length.out

an integer giving the length of the grid.

Value

an object of the same type as x, with length.out or fewer unique values.

Note

for unordered factors and characters, if length.out < length(unique(x)) length.out is set to length(unique(x)). if x is a data.frame and this is true of some columns but not others, there will be a warning.

Examples

data = data.frame(
  w = seq(0, 1, length.out = 5),
  x = factor(letters[1:5]),
  y = ordered(1:5),
  z = 1:5
)

lapply(data, uniformGrid, length.out = 5)

mmpf

Monte-Carlo Methods for Prediction Functions

v0.0.5
MIT + file LICENSE
Authors
Zachary Jones [aut, cre]
Initial release
2018-10-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.