R Studio on BigQuery
  • 18 Aug 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

R Studio on BigQuery

  • Dark
    Light
  • PDF

Article Summary

Panoply on BigQuery

To connect RStudio to your BigQuery data warehouse to :

  1. Install the BigRQuery package. You can do this in your R environment by running the following:

    install.packages("bigrquery")

  2. Install the readr package . This will allow you to run SQL queries and retrieve their results directly in rStudio. You can do this in your R environment by running the following:
    install.packages("readr")

  3. Load the DBI library and provide the connection details as shown below:

     library(DBI)
     con <- dbConnect(
         bigrquery::bigquery(),
         project = "<project ID>",
         dataset = "<dataset>",
         billing = "<project ID>"
     )
    
  4. Run a command to query your data. For example: dbListTables(con) will list all the tables in the selected dataset.

  5. On the first time you connect, you will need to authenticate with your dwh-panoply.io account you created when signing up to Panoply and copy the authorization code given to you post authentication into the rStudio application.

You have successfully connected R Studio to your BigQuery data warehouse.


Was this article helpful?