Learn R Programming

BBEST (version 0.1-8)

trim.data: Truncate data

Description

The function truncates the data (deletes low- and high-x information).

Usage

trim.data(data, x.min, x.max)

Value

an object of type data with all functions cropped to the region [x.min, x.max]

Arguments

data

an object of type data. See set.data for details.

x.min, x.max

numeric values determining the region to keep.

Details

Frequently, the experimental data need to be truncated to remove unwanted ranges.

Examples

Run this code
# prepare data
x <- seq(0, 50, 0.01)
y <- .8*exp(-x)*x^4 
dat <- list(x=x, y=y)
# truncate
dat <- trim.data(dat, 1, 25)
# plot results
plot(x,y,t="l",lwd=4, col=4)
lines(dat$x, dat$y, lwd=4, col=2)
legend(15,3,c("initial", "truncated"), lty=1, col=c(4,2))

Run the code above in your browser using DataLab