The bigrquery packages provides an R interface to Google BigQuery. It makes it easy to retrieve metadata about your projects, datasets, tables and jobs, and provides a convenient wrapper for working with bigquery from R.
Here, we look for the lowest block IDs in the Bitcoin blockchain and want to know when they were.
Note for CoCalc: oauth 2.0 setup via httr requires a local browser (I don't know how to use this text based). So, run this in your local R instance and then upload the .httr-oauth file into your projects home directory.
library(tidyverse)library(lubridate)library(bigrquery)library(tibble)project<-"...."# put your project ID here
sql<-"SELECTblock_id,difficultyTarget,STRING(timestamp) AS timestampFROM[bigquery-public-data:bitcoin_blockchain.blocks]ORDER BYblock_id ASCLIMIT10"# execute the query and store the resultlowest_blocks<-query_exec(sql,project=project)lowest_blocks