read_sql | R Documentation |
read_sql
is given either a fully-written SQL query through the query
argument or a valid table name through the table
argument.
read_sql(query, billing_project_id = get_billing_id())
query |
a string containing a valid SQL query. |
billing_project_id |
a string containing your billing project id. If you've run |
A tibble containing the query's output.
## Not run: set_billing_id("<your id here>") query <- "SELECT pib.id_municipio, pop.ano, pib.PIB / pop.populacao * 1000 as pib_per_capita FROM `basedosdados.br_ibge_pib.municipio` as pib JOIN `basedosdados.br_ibge_populacao.municipio` as pop ON pib.id_municipio = pop.id_municipio LIMIT 5 " data <- read_sql(query) # in case you want to write your data on disk as a .xlsx, .csv or .Rds file. library(writexl) library(readr) dir <- tempdir() write_xlsx(data, file.path(dir, "data.xlsx")) write_csv(data, file.path(dir, "data.csv")) saveRDS(data, file.path(dir, "data.Rds")) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.