binTimeSeries: Binned representation of a time series

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/binTimeSeries.R

Description

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

Usage

1
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

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.

Value

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

Author(s)

Alejandro Linares

See Also

binMatrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
### 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")

FCSlib documentation built on Nov. 27, 2020, 5:09 p.m.

Related to binTimeSeries in FCSlib...