as.data.frame.ABF: Coerces an ABF Object to a Data Frame

Description Usage Arguments Value Examples

Description

S3 method to coerce an ABF object to a data frame.

Usage

1
2
3
## S3 method for class 'ABF'
as.data.frame(x, row.names = NULL, optional = FALSE, ..., sweep = NULL,
type = c("all", "one"), channels, unit = NULL)

Arguments

x

an object of class ABF, typically generated by readABF.

row.names, optional, ...

further arguments in case they are passed from other methods; they will be ignored.

sweep

an integer, indicating which sweep should be coerced; required in case of multiple sweeps, otherwise ignored.

type

a string specifying the return value, see ‘Value’.

channels

an integer vector of length one or two; required if type == "one", otherwise ignored, see ‘Value’.

unit

a string, specifying the unit of one, if NULL unit will be determined by units in x; ignored if type == "all" or length(channels) == 1

Value

A data.frame. The first column always contains the time which is calculated from the sampling interval. The earliest data point is believed to be at time 1 divided by the sampling rate.

Column names are accompanied by their units.

If type == "all", all channels are added to the resulting data frame. Their units are copied from the ABF object.

If type == "one", the resulting data frame only contains the time (see above) and one additional column with the actual data, whereby channels, a vector of integers, specifies what to read. If channels contains one index, then that channel is used for the data column. If channels contains two indices, then the data of the first channel is divided by the data of the second channel. This might be for instance helpful to obtain conductance by dividing a channel containing current values by a channel containing voltage values. The unit of the data column is either provided by unit or, if not provided, the ratio of the two units (as read from the ABF object) is given.

Examples

1
2
3
# loads an example file and coerces its first sweep to data frame
r <- readABF(system.file("extdata", "2009_01_19_0002_varlen_v18.abf", package="readABF"))
as.data.frame(r, sweep=1)

Zabolekar/readABF documentation built on July 26, 2020, 11:35 p.m.