R
R
Installation
Ubuntu
apt install r-base
Alma Linux
dnf install epel-release
dnf install R
Arch Linux
pacman -S r
Examples
Fibonacci Numbers
# Fibonacci Numbers
fib <- function(n) {
if (n < 2)
return(n)
else
return(fib(n - 2) + fib(n - 1))
}
argv <- commandArgs(TRUE)
n <- as.integer(argv[1])
cat(fib(n))
# example
# run:
# Rscript fib.r 30