Notes on Code Translation to R
This help page describes details particular to code translation using the CodeGeneration[R] function. For general information applicable to all the functions in the CodeGeneration package, see CodeGeneration/Details.
<Text-field style="Heading 2" layout="Heading 2" bookmark="info">Description</Text-field>
The R code generated by CodeGeneration[R] is valid for R version 3 as defined by the R Language Specification.
In addition to the functions listed on the CodeGeneration/Details help page, the following Maple functions are recognized by CodeGeneration[R]: cat, ceil, floor, and if (operator form).
Maple functions recognized by CodeGeneration[R], including those for math, linear algebra, statistics, and special functions, are translated to equivalent functions in base packages in R, including the base, combinat, Matrix, psych, graphics, and stats packages.
The following list contains statistics commands with limited support for translation:AutoCorrelationBarChartBiplotBoxPlotChiSquareIndependenceTestColumnGraphCorrelationCountCountMissingCovarianceCrossCorrelationCumulativeDistributionFunctionDecileDetrendDifferenceFivePointSummaryHistogramInterquartileRangeMeanMedianMedianDeviationOneSampleTTestParetoChartPCAPercentilePieChartPrincipalComponentAnalysisProbabilityDensityFunctionProbabilityFunctionQuantileQuartileRangeRankSampleScaleScreePlotSeasonalSubseriesPlotShapiroWilkWTestShuffleStandardDeviationStandardErrorSunflowerPlotTallyTimeSeriesTimeSeriesPlotTwoSampleFTestTwoSamplePairedTTestTwoSampleTTestVarianceVariation
There are differences in how Maple and R treat named probability distributions. In Maple, a distribution can be referenced by the distribution name directly inside of Statistics commands, for example, Statistics:-CDF( Normal(..), .. ). In R, distributions are included in the containing command itself, pnorm(..). A warning message will always be returned when CodeGeneration[R] attempts to translate an expression that contains a reference to a named distribution. When possible, Maple will still attempt to translate the containing expression to an equivalent command in R.
CodeGeneration[R] translates printf statements to its own printf.out calls, but performs only limited analysis of the printf format string. Thus, some formatting instructions (for example, precision for floats) can be ignored in translation.
Ranges of Maple lists and Arrays are adjusted so that the resulting R lists start with index 0.
See AlsoCodeGenerationCodeGeneration/DetailsCodeGeneration[R]