matlab2r | R Documentation |
Performs basic syntax conversion from a Matlab function file to R
matlab2r( input, output = "diff", improve_formatting = TRUE, change_assignment = TRUE, append = FALSE, restyle = !improve_formatting, skip_lines = NULL )
input |
file path or character string containing MATLAB code |
output |
can be "asis", "clean", "save" or "diff" |
improve_formatting |
if |
change_assignment |
if |
append |
if |
restyle |
if |
skip_lines |
vector of lines to be skipped. These will be commented out and tagged as TODO, instead. |
text converted to R, printed to screen or replacing input file
This function is intended to expedite the process of converting a Matlab function to R by making common replacements. It does not have the immediate goal of outputting a ready-to-use function. In other words, after using this function you should go back to it and make minor changes.
It is also advised to do a dry-run with output = "clean"
and only switching
to output = "save"
when you are confident that no important code will be
lost (for shorter functions, a careful visual inspection should suffice).
Waldir Leoncio
matlab_script <- system.file("extdata", "matlabDemo.m", package = "matlab2r") matlab2r(matlab_script) matlab2r(matlab_script, output = "clean")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.