makeSliceMap: Make the maps for converting slice notation

Description Usage Arguments Details Value Examples

View source: R/convData.R

Description

Make the maps for converting slice notation

Usage

1
makeSliceMap(leftSym, rightSym, rClass, matClass = "")

Arguments

leftSym

The left symbol that contains the Matlab data

rightSym

the right symbol that contains the Matlab data

rClass

The formal r class name that defines what the R data is outputted as

matClass

The name of the Matlab class that should be converted

Details

Slice notation for matrices are tricky because they can easily be confused with the requirements for conversion are the bounds given by both left and right symbols or the Matlab class. The Matlab class allows for the conversion of structures but is really just a dictionary for the different bounds.

Value

A function that takes in a string and converts all the given slice notation

Examples

1
2
3
4
5
6
7
  sliceMap <- makeSliceMap("{", "}", "list")
  sliceMap("junk <- importData{300}")
  # "junk <- importData[[300]]"
  
  sliceMap <- makeSliceMap(matClass = "structure", rClass = "list")
  sliceMap("junk <- students.AP.GPA")
  # junk <- students[['AP']][['GPA']]

matconv documentation built on May 13, 2021, 9:06 a.m.