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

adapt_seq

Adaptively generate sequences in an interval


Description

adapt_seq is similar to seq except that instead of selecting points equally spaced along an interval, it selects points such that the values of a function applied at those points are (very) roughly equally spaced. This can be useful for sampling a function in such a way that it can be plotted more smoothly, for example.

Usage

adapt_seq(
  from,
  to,
  length.out = 200,
  f = function(x, ...) {     1 },
  args = list(),
  quiet = FALSE
)

Arguments

from

start of interval

to

end of interval

length.out

desired length of sequence

f

a function

args

arguments passed to f

quiet

suppress warnings about NaNs, etc.

Value

a numerical vector

Examples

adapt_seq(0, pi, 25, sin)

mosaic

Project MOSAIC Statistics and Mathematics Teaching Utilities

v1.8.3
GPL (>= 2)
Authors
Randall Pruim [aut, cre], Daniel T. Kaplan [aut], Nicholas J. Horton [aut]
Initial release

We don't support your browser anymore

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