makeSliceMap {matconv} | R Documentation |
Make the maps for converting slice notation
makeSliceMap(leftSym, rightSym, rClass, matClass = "")
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 |
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.
A function that takes in a string and converts all the given slice notation
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']]