Learn R Programming

FCSlib (version 1.3.0)

binTimeSeries: Binned representation of a time series

Description

Groups large vectors into several bins of a given length for better (and faster) data plotting

Usage

binTimeSeries(f, acqTime, nIntervals, mode = "mean", plot = TRUE)

Arguments

f

Numeric vector

acqTime

Point acquisition rate (in seconds)

nIntervals

Number of intervals into which the vector will be grouped

mode

Set to "mean" (default) or "sum" to average or sum all the points in every interval, respectively

plot

Boolean, set to TRUE (default) to plot the result

Value

A data frame with two variables (Counts and Time) and 'nIntervals' observations

Details

This function groups all the points in the vector 'f' into 'nIntervals' bins of length = length(f)/nIntervals. Then, averages or sums all of the points in each bin and plots the result.

See Also

binMatrix

Examples

Run this code
# NOT RUN {
### Please navigate to
### (https://github.com/FCSlib/FCSlib/tree/master/Sample%20Data)
### to find this sample data

# Automatic plot
x <- readFileTiff("Cy5.tif")
x <- as.vector(x)
x <- binTimeSeries(x[length(x):1], 2e-6, 100, mode = "mean", plot = T)

# Manual plot (useful for adding custom labels)
x <- readFileTiff("Cy5.tif")
x <- as.vector(x)
x <- binTimeSeries(x[length(x):1], 2e-6, 100, mode = "mean", plot = F)
plot(x$Counts~x$Time, type = "l")
# }

Run the code above in your browser using DataLab