rrecursionfunctional-programmingtail-recursion# Tail recursion on R Statistical Environment

Does R support proper tail recursion and where can I find documentation about this?

Solution

It's quite easy to find out that R does not support tail recursion optimization:

```
f <- function(n) {
if (n != 0) f(n-1)
}
f(100000)
# Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
```

Had tail calls been optimized to jumps, then this function would have terminated without problems.

- R - windowing data backwards from latest data in non-overlapping (not-rolling) periods and counting within periods
- Asymmetric partial matching of text strings between two dataframes
- R: assign dataframe column values using external vectors
- is it possible to redirect console output to a variable?
- Package for category overlines on scatterplot in ggplot
- Identify connected subnetworks (R-igraph)
- Setting up the inoreader API in R
- full_join in R with NA as wildcard to match any value in the other data.frame
- Iterate through ID-matched Euclidean distances using dist() in R
- Calculate new column giving trend/slope across other columns using data.table R
- Single item generation with build_fa / plot_fa (IMak package in R)
- How to a create recursive variable per group in data frame?
- Using dplyr to conditionally replace values in a column
- How to format a number as percentage in R?
- Ggplot2 fill legend labels not in correct order
- TreeNode printing and colorizing the branches
- Changing font size and direction of axes text in ggplot2
- Creating buttons for a dropdown automatically with Plotly
- Multiple tags getting captured while web scraping Reddit in R using RSelenium
- Colors assigned to geom_point() code blocks only work when reversed?
- Vim: underscore(_) automatically converted to (<-)
- geom_hline will not show up whereas it did before
- How can I create a cross-table by multiple variables in R?
- R - getting count of maximum-sized sub-group when summarising at prior group_by level
- R cv.glmnet error doesn't match manual calculation
- Fitting a lognormal or poisson distribution
- How to change the plot background color generated by plot(effect(...)) in grey with white grid in R？
- Rolling left join with value fill for all the rows in the left table
- Removing punctuations from text using R
- Optimisation problem with constraint in R: how to solve problem with "complex" logarithmic benefit functions?