LinuxCommandLibrary

littler

TLDR

Run R expression

$ r -e "print('Hello')"
copy
Run R script
$ r [script.R]
copy
Install package
$ r -e "install.packages('[package]')"
copy
Pipe data to R
$ echo "[1,2,3]" | r -e "sum(scan())"
copy
Run with arguments
$ r [script.R] [arg1] [arg2]
copy

SYNOPSIS

r [options] [script] [args...]

DESCRIPTION

littler (r) provides a shebang-capable scripting interface for R. It allows running R code from the command line and in scripts, making R more accessible for shell scripting and automation.
littler starts faster than R --vanilla by avoiding R's full initialization.

PARAMETERS

-e expr

Evaluate expression.
-p
Print result.
-l package
Load package.
-i
Interactive mode.
-n
No implicit printing.
-t
Use temporary directory.
-v
Verbose output.

SHEBANG USAGE

$ #!/usr/bin/env r

args <- commandArgs(TRUE)
print(paste("Hello", args[1]))
copy

CAVEATS

Must be installed separately from R. The command 'r' may conflict with other tools. Package loading adds startup time.

HISTORY

littler was created by Dirk Eddelbuettel and Jeff Horner in 2006 to provide a proper scripting interface for R.

SEE ALSO

R(1), Rscript(1), rpy2(1)

Copied to clipboard