read_motive_csv() is designed to import data from a CSV that has been
exported from Optitrack's Motive software. The resultant object is a tibble
that additionally has important metadata stored as attributes (see Details).
A file (or path to file) in CSV format
(Optional) identifier for this file. If not supplied, this
If Markers are encountered, should they be renamed from "Subject:marker" to "marker"? Defaults to TRUE
Additional arguments passed from other
data.table::fread() to import data from a CSV file and
ultimately store it in a tibble. This object is also labeled with the
pathviewr_steps with value
viewr to indicate that it
has been imported by
pathviewr and should be friendly towards use with
other functions in our package. Additionally, the following metadata are
stored in the tibble's attributes: header information from the Motive CSV
header), original IDs for each object (
name of each subject in each data column (
unique values of subject names (
subject_names_simple), the type of
data (rigid body or marker) that appears in each column
data_types_full) and overall (
data_types_simple), and original
data column names in the CSV (
d1, d2). See Example below for example
code to inspect attributes.
A tibble with numerical data in columns. The first two columns will have frame numbers and time (assumed to be in secs), respectively. Columns 3 and beyond will contain the numerical data on the position or rotation of rigid bodies and/or markers that appear in the Motive CSV file. Each row corresponds to the position or rotation of all objects at a given time (frame).
This function was written to read CSVs exported using Motive's Format Version 1.23 and is not guaranteed to work with those from other versions. Please file an Issue on our Github page if you encounter any problems.
Vikram B. Baliga
read_flydra_mat for importing Flydra data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
library(pathviewr) ## Import the example Motive data included in the package motive_data <- read_motive_csv(system.file("extdata", "pathviewr_motive_example_data.csv", package = 'pathviewr')) ## Names of variables in the resulting tibble names(motive_data) ## A variety of metadata are stored as attributes. Of particular interest: attr(motive_data, "pathviewr_steps") attr(motive_data, "file_id") attr(motive_data, "header") attr(motive_data, "Motive_IDs") attr(motive_data, "subject_names_full") attr(motive_data, "subject_names_simple") attr(motive_data, "motive_data_names") attr(motive_data, "motive_data_types_full") attr(motive_data, "motive_data_types_simple") ## Of course, all attributes can be viewed as a (long) list via: attributes(motive_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.