as.data.frame.tracks: Convert Tracks to Data Frame

View source: R/data-structures.R

as.data.frame.tracksR Documentation

Convert Tracks to Data Frame

Description

Converts tracks from the list-of-matrices format, which is good for efficient processing and therefore the default in this package, to a single dataframe which is convenient for plotting or saving the data.

Usage

## S3 method for class 'tracks'
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  include.timepoint.column = FALSE,
  idsAsFactors = TRUE,
  ...
)

Arguments

x

the tracks object to be coerced to a data frame.

row.names

NULL or a character vector giving row names for the data frame. Missing values are not allowed.

optional

logical. Required for S3 consistency, but has no effect: column names are always assigned to the resulting data frame regardless of the setting of this option.

include.timepoint.column

logical. If set to TRUE, then the resulting dataframe will contain a column that consecutively numbers the positions according to their time. Note that this information is anyway implicitly present in the time information.

idsAsFactors

logical. If TRUE, then the id column of the resulting dataframe will be a factor column, otherwise a characeter column.

...

further arguments to be passed from or to other methods.

Value

A single data frame containing all individual tracks from the input with a prepended column named "id" containing each track's identifier in 'x'.

Examples

## Display overall average position of the T cell data
colMeans( as.data.frame( TCells )[-c(1,2)] )

celltrackR documentation built on March 21, 2022, 5:06 p.m.