Learn R Programming

RSocrata (version 1.7.15-1)

write.socrata: 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

Mark Silverberg mark.silverberg@socrata.com

Examples

Run this code
if (FALSE) {
# 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)
}

Run the code above in your browser using DataLab