if (FALSE) {
# Download all columns in a single table into a CSV
download_civis("schema.table", database = "my_database",
file = "~/Downloads/my_table.csv")
# Download data from a SQL select statement into a CSV
query <- sql("SELECT * FROM table JOIN other_table USING id WHERE var1 < 23")
download_civis(query, database = "my_database",
file = "~/Downloads/my_table.csv")
# Set a default database
options(civis.default_db = "my_database")
# Download any file from the files endpoint.
file_id <- write_civis_file(df)
download_civis(file_id, file = "df.rds", progress = TRUE)
df2 <- readRDS("df.rds")
identical(df, df2)
}
Run the code above in your browser using DataLab