R-first soil data lab

Query soil data with R at the center.

Start an R session in your browser, edit and run a soil-profile example, then inspect the soilDB::SDA_query() pattern this prototype is preparing to run through a server-side R worker.

soil_query.R
> library(soilDB)
> soils <- SDA_query(sql)
> head(soils)
  areasymbol musym       muname
1      UT621  1000 Parleys loam
Soil data API Connecting…
webR://soil-session Runs locally in this browser

Interactive R session

Initialize R, edit the code, and run it.

A pinned webR runtime executes base R locally. This first example turns horizon observations into a small soil profile summary—no server execution and no data upload.

  1. 01Download webRPinned release
  2. 02Start RWebAssembly worker
  3. 03Run codeLocal session
base R · runnable
stdout + errors
Browser R is not initialized.

Select “Initialize browser R” to start the local runtime.

The server-R destination

A real soilDB query recipe

This is the R workflow the web wrapper is designed to expose safely. It uses a bounded area-symbol query and returns an R data frame from USDA Soil Data Access.

Why it is shown, not run here The complete soilDB package and its compiled dependencies belong in the planned server-side R worker. Browser R above supports the local base-R experiment today.
Copy this recipe into an R environment with soilDB installed.
query_map_units.R
area_symbol <- "UT621"

sql <- sprintf("
  SELECT TOP 25
    l.areasymbol, mu.musym, mu.muname, mu.mukey
  FROM legend AS l
  INNER JOIN mapunit AS mu ON l.lkey = mu.lkey
  WHERE l.areasymbol = '%s'
  ORDER BY mu.musym
", area_symbol)

soils <- soilDB::SDA_query(sql)
head(soils)

Guided web workflow

Use the same soil-data boundary without writing SQL.

Choose a county or survey code below. The local API validates the input, sends curated SQL to USDA, and returns the records with provenance.

Step 1

Build a guided query

Validated inputs
How do you want to choose an area?
Find the survey areas that overlap this county.
Selected survey code UT621 Utah County, Utah – Central Part
BrowserLocal APIUSDA SDA
What this tests

This prototype uses curated SQL through a local proxy. The API seam is ready for a server-side R soilDB worker once that runtime is containerized.

Step 2

Inspect the feedback loop

Rows
Round trip
Source
Retrieved

Step 3

Review returned soil records

Results will appear here after a successful request.