Skip to content
Transformations

How do I run an R transformation?

Create, run, and develop an R transformation in Keboola — write the script, map input and output CSV files, run it, confirm the result, and debug it in a workspace or locally.

You want to run advanced statistical or vector/matrix computations with R. An R transformation reads your mapped input tables as CSV files, runs your script, and writes CSV outputs back to Storage. This page gets you from nothing to a successful run, then shows how to develop and debug. For limits, packages, and CSV rules, see the reference.

Time: ~10 minutes · You will need: a Keboola project and one table in Storage (or the sample CSV file).

  1. Open Components → Transformations, click New Transformation, and choose R Transformation.
  2. Name it and confirm.
  1. Upload the sample CSV file to Storage as a table.
  2. In Input Mapping, add it and set its Destination to source (the script reads in/tables/source.csv).
  3. In Output Mapping, map result.csv to a new Storage table, for example out.c-main.result.
data <- read.csv(file = "in/tables/source.csv")
df <- data.frame(
col1 = paste0(data$first, 'ping'),
col2 = data$second * 42
)
write.csv(df, file = "out/tables/result.csv", row.names = FALSE)

Always write outputs with row.names = FALSE — see row index in output tables. You can split the script into blocks.

  1. Click Run.
  2. Wait for the job to finish with a success status.
  3. Open Storage, find your output table, and confirm col1 has the ping suffix and col2 is second × 42.

The fastest way to iterate is an R workspace with the same input mapping. While developing, read fewer rows to catch issues quickly:

mydata <- read.csv("in/tables/mydata", nrows=500)

To develop locally, install R (preferably the same version as Keboola) and recreate the directory structure (in/tables/, out/tables/, and in/user/ for extension-less binary files) with your input files. A ready example is in data.zip; the same script then runs unchanged as a transformation. For an exact environment, use the Keboola Docker image.

For large data, raise the Backend size in the configuration (XSmall → Small → Medium → Large); see backend sizes. This affects time-credit consumption.

SymptomLikely causeFix
Transformation fails on a harmless warningWarnings are converted to errorsFix the cause, or wrap the code in tryCatch(..., warning = function(w) {}) (reference).
Extra unnamed column / import failsRow index written to the CSVWrite with row.names = FALSE.
cannot open file 'in/tables/source.csv'Input destination doesn’t match the pathSet the input Destination to source.
Output table empty / not createdOutput Source doesn’t match the file the script writesMap result.csv.
Ask Kai

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