makeDataMap: Make the maps for the data

Description Usage Arguments Details Value Examples

View source: R/convData.R

Description

Make the maps for the data

Usage

1
makeDataMap(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

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 Matlab lines and changes the data into R data lines

Examples

1
2
3
4
5
6
7
	 dataMap <- makeDataMap("[", "]", "matrix")
	 dataMap("thing <- [23,2, 3.2; 7, 6, 8]")
	 # "thing <- matrix(c(23, 2, 3.2, 7, 6, 8), nrow = 2, ncol = 3)"
	 
	 dataMap <- makeDataMap(rClass = "list", matClass = "cell")
	 dataMap("otherThing <- {23,2, '3.2'; NaN, 6, 8}")
	 # "otherThing <- list(list(23, 2, '3.2'), list(NaN, 6, 8))"

Example output

[1] "thing <- matrix(c(23, 2, 3.2, 7, 6, 8), nrow = 2, ncol = 3)"
[1] "otherThing <- list(list(23, 2, '3.2'), list(NaN, 6, 8))"

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