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).
Step 1 — Create the transformation
Section titled “Step 1 — Create the transformation”- Open Components → Transformations, click New Transformation, and choose R Transformation.
- Name it and confirm.
Step 2 — Map input and output
Section titled “Step 2 — Map input and output”- Upload the sample CSV file to Storage as a table.
- In Input Mapping, add it and set its Destination to
source(the script readsin/tables/source.csv). - In Output Mapping, map
result.csvto a new Storage table, for exampleout.c-main.result.
Step 3 — Write the script
Section titled “Step 3 — Write the script”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.
Step 4 — Run it and confirm the result
Section titled “Step 4 — Run it and confirm the result”- Click Run.
- Wait for the job to finish with a success status.
- Open Storage, find your output table, and confirm
col1has thepingsuffix andcol2issecond × 42.
Develop and debug
Section titled “Develop and debug”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.
Make it faster (backend size)
Section titled “Make it faster (backend size)”For large data, raise the Backend size in the configuration (XSmall → Small → Medium → Large); see backend sizes. This affects time-credit consumption.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause | Fix |
|---|---|---|
| Transformation fails on a harmless warning | Warnings are converted to errors | Fix the cause, or wrap the code in tryCatch(..., warning = function(w) {}) (reference). |
| Extra unnamed column / import fails | Row index written to the CSV | Write with row.names = FALSE. |
cannot open file 'in/tables/source.csv' | Input destination doesn’t match the path | Set the input Destination to source. |
| Output table empty / not created | Output Source doesn’t match the file the script writes | Map result.csv. |
Related
Section titled “Related”- R transformation reference — limits, packages, CSV, logging.
- In-depth examples: array splitting · charts & graphs · binary files.
- Workspaces · Input and output mapping.