Skip to content
Transformations

R transformation reference

Lookup reference for R transformations in Keboola — runtime environment and version, limits, file locations, packages, CSV format, row-index handling, warnings-as-errors, backend sizes, and logging.

Reference material for R transformations. To create and run one, see the how-to.

The R script runs in an isolated environment. The current R version is 4.4.1; you can switch a configuration to other available versions. Version updates are announced in the changelog.

ResourceLimit
Memory16 GB
Max running time6 hours
CPUEquivalent of two 2.3 GHz processors
  • The script is compiled to /data/script.R.
  • Mapped input/output tables: relative in/tables/file.csv, out/tables/file.csv or absolute under /data/.
  • Downloaded files: in/files/ (or /data/in/files/).
  • Temporary files: /tmp/. Do not use /data/ for files you don’t want exchanged with Keboola.

See the full Common Interface specification.

R transformations can use any package on CRAN. List a package’s name in the package section to load and install it (with dependencies) automatically — library() is then not needed. The latest versions are installed.

Some packages are preinstalled (with dependencies); for an authoritative list use installed.packages(). Adding a preinstalled package explicitly does no harm but slows startup due to forced re-installation.

Input tables arrive as CSV and can be read with standard R functions. If R misreads the format, specify it explicitly:

data <- read.csv("in/tables/in.csv", sep=",", quote="\"")

Do not write the row index — use row.names=FALSE. The row index creates an unnamed column that cannot be imported to Storage.

write.csv(data, file="out/tables/out.csv", row.names=FALSE)

If the row names hold real data, convert them to a column first:

df <- data.frame(first = c('a', 'b'), second = c('x', 'y'))
data <- cbind(rownames(df), df)
write.csv(data, file="/data/out/tables/out.csv", row.names=FALSE)

The environment converts all warnings to errors, which fail the transformation. To deliberately ignore warnings from a piece of code, wrap it in tryCatch:

tryCatch(
{ ... some code ... },
warning = function(w) {}
)

Print informational/debug messages by printing to stdout/stderr. The internally available app$logInfo and app$logError functions record the precise server time of an event (the standard job-event timestamp is when the event was received, converted to local time):

print('doing something')
write('error message', stderr())
app$logInfo("information")
app$logError("error")

A larger backend allocates more resources for long or heavy transformations. Available sizes:

Size
XSmall
SmallDefault
Medium
Large

Scaling up impacts time-credit consumption. Dynamic backends are not available on the Free Plan (Pay As You Go).

Ask Kai

Ask anything about Keboola — I'll search the docs and cite the pages I use.