Last data update: 2014.03.03

R: Truncate data
trim.dataR Documentation

Truncate data

Description

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

Usage

trim.data(data, 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.

Value

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

Examples

# 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))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BBEST)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BBEST/trim.data.Rd_%03d_medium.png", width=480, height=480)
> ### Name: trim.data
> ### Title: Truncate data
> ### Aliases: trim.data
> ### Keywords: set data
> 
> ### ** Examples
> 
> # 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))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>