struct2dataframe: Load MATLAB structs as R data frames

Description Usage Arguments Details Value Examples

View source: R/struct2datatable.R

Description

A simple wrapper for readMat for structs that additionally converts the resulting list into a data frame.

Usage

1

Arguments

fn

A full (character) filename path pointing to the desired .mat file created by save(). The file must be saved in v6 or before (since R.matlab can't deal with HDF5-like files yet).

var

A character variable name, if a specific variable is desired from the .mat file. If no variable is specified, struct2datable will attempt to process the first variable listed.

Details

struct2dataframe is basically just a replacement for a few lines of code, but saves some time and ensures that the struct you clearly meant as a data frame for processing or plotting in R actually shows up as a data frame.

Value

A data frame will be returned with the struct fields as variables and the struct elements as observations

Examples

1
## Not run: struct2dataframe("~/code/some_struct_v6.mat")

ks905383/importr documentation built on May 7, 2019, 5:01 a.m.