write.socrata: Write to a Socrata dataset (full replace or upsert)

View source: R/RSocrata.R

write.socrataR Documentation

Write to a Socrata dataset (full replace or upsert)

Description

Method for updating Socrata datasets

Usage

write.socrata(
  dataframe,
  dataset_json_endpoint,
  update_mode,
  email,
  password,
  app_token = NULL
)

Arguments

dataframe

- dataframe to upload to Socrata

dataset_json_endpoint

- Socrata Open Data Application Program Interface (SODA) endpoint (JSON only for now)

update_mode

- "UPSERT" or "REPLACE"; consult https://dev.socrata.com/publishers/getting-started.html

email

- The email to the Socrata account with read access to the dataset

password

- The password associated with the email to the Socrata account

app_token

- a (non-required) string; SODA API token can be used to query the data portal https://dev.socrata.com/consumers/getting-started.html

Author(s)

Mark Silverberg mark.silverberg@socrata.com

Examples

## Not run: 
# Store user email and password
socrataEmail <- Sys.getenv("SOCRATA_EMAIL", "mark.silverberg+soda.demo@socrata.com")
socrataPassword <- Sys.getenv("SOCRATA_PASSWORD", "7vFDsGFDUG")

datasetToAddToUrl <- "https://soda.demo.socrata.com/resource/xh6g-yugi.json" # dataset

# Generate some data
x <- sample(-1000:1000, 1)
y <- sample(-1000:1000, 1)
df_in <- data.frame(x,y)

# Upload to Socrata
write.socrata(df_in,datasetToAddToUrl,"UPSERT",socrataEmail,socrataPassword)

## End(Not run)

RSocrata documentation built on Aug. 31, 2023, 9:07 a.m.