# Transpiler from R to Fortran

**URL:** <https://fortran-lang.discourse.group/t/transpiler-from-r-to-fortran/10935>\
**Category:** Uncategorized\
**Created:** [May 30, 2026, 10:15am UTC](https://fortran-lang.discourse.group/t/transpiler-from-r-to-fortran/10935 "2026-05-30T10:15:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [May 30, 2026, 10:15am UTC](https://fortran-lang.discourse.group/t/transpiler-from-r-to-fortran/10935/1 "2026-05-30T10:15:49Z")

</div>

> **[GitHub - Beliavsky/R-to-Fortran: Transpiler from R to Fortran written in Python](https://github.com/Beliavsky/R-to-Fortran)**
>
> Transpiler from R to Fortran written in Python

Using Codex I wrote a partial transpiler from R to Fortran. Please submit R codes for which it fails.

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [August 14, 2026, 7:44pm UTC](https://fortran-lang.discourse.group/t/transpiler-from-r-to-fortran/10935/2 "2026-08-14T19:44:30Z")

</div>

The previous version of the transpiler converted R syntax for loops, conditionals, array access, and functions etc. to Fortran, but R also has a lot of built-in statistical and linear algebra algorithms, which are now in a module, documented [here](https://github.com/Beliavsky/R-to-Fortran/blob/main/xr2f_runtime_api.md), that the transpiler or stand-alone Fortran programs can use. There are procedures for

- Printing Arrays
- Vectors, Sequences, and Repetition
- Matrices and Array Semantics
- Set, Match, and Index Helpers
- Random Numbers and Sampling for Many Distributions
- Probability and Special Functions
- Summary Statistics and Linear Algebra
- Data Frames, Tables, and Grouped Operations
- Model and Test Result Types (the result of a statistical analysis is returned in a derived type)
- Optimization and Integration
- Smoothers and Time-Series Analysis
- Clustering
- Dates, Files, and Strings
