R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

list googlesheets

library(googledrive)

drive_find()
## > Using an auto-discovered, cached token
##   To suppress this message, modify your code or options to clearly consent to
##   the use of a cached token
##   See gargle's "Non-interactive auth" vignette for more details:
##   <https://gargle.r-lib.org/articles/non-interactive-auth.html>
## > The googledrive package is using a cached token for 'gbbuck@gmail.com'
## Items so far:
## 188
## # A tibble: 188 x 3
##    name                                id                        drive_resource 
##  * <chr>                               <chr>                     <list>         
##  1 DIDSON_Catalog                      1t5lvReGpx6SqMbYZiOuh8V-~ <named list [3~
##  2 Book1                               1b5PoZNeoGqHIHEWOGdBAqaS~ <named list [3~
##  3 googledocs_test.Rmd                 1c_WN7-kYO8QwxDab0alNqth~ <named list [3~
##  4 Searchable table of businesses boy~ 1S-hoVR1hsLMYAxvPUGDYhT8~ <named list [3~
##  5 BestStorage-South_CreditCardExpira~ 1_zBZKeVUV4MuwC_MxwBLS9C~ <named list [3~
##  6 COVID-19 Live Reports (WA)          18_hDK88UQq0EE5OfA0uOASD~ <named list [3~
##  7 THE TRUTH ABOUT “DRAMATIC ACTION”   1av6mBNPn70dHM5wAQxWfvK0~ <named list [3~
##  8 The Software Architecture of WayUp~ 1AOlQj1IiBj0CUjk2750IJID~ <named list [3~
##  9 Book2                               10_9806uCXwqO2Uen0SnQzgb~ <named list [3~
## 10 Buck_Job_search.docx                0B9vXn1VsK0v6Z2NralhZcXB~ <named list [3~
## # ... with 178 more rows
library(ggplot2)
library(googlesheets4)
## 
## Attaching package: 'googlesheets4'
## The following objects are masked from 'package:googledrive':
## 
##     request_generate, request_make
library(googledrive)

# designate project-specific cache
options(gargle_oauth_cache = ".secrets")

# check the value of the option, if you like
gargle::gargle_oauth_cache()
## [1] ".secrets"
# trigger auth on purpose --> store a token in the specified cache
drive_auth()
## > Using an auto-discovered, cached token
##   To suppress this message, modify your code or options to clearly consent to
##   the use of a cached token
##   See gargle's "Non-interactive auth" vignette for more details:
##   <https://gargle.r-lib.org/articles/non-interactive-auth.html>
## > The googledrive package is using a cached token for 'gbbuck@gmail.com'
# see your token file in the cache, if you like
list.files(".secrets/")
## [1] "403989c6238327f1ac25c387a000c783_gbbuck@gmail.com"
## [2] "bb8565617b5e9996ff93e6d214ba7218_gbbuck@gmail.com"
options(
  gargle_oauth_cache = ".secrets",
  gargle_oauth_email = TRUE
)

# now use googledrive with no need for explicit auth
drive_find(n_max = 5)
## # A tibble: 5 x 3
##   name                                 id                        drive_resource 
## * <chr>                                <chr>                     <list>         
## 1 DIDSON_Catalog                       1t5lvReGpx6SqMbYZiOuh8V-~ <named list [3~
## 2 Book1                                1b5PoZNeoGqHIHEWOGdBAqaS~ <named list [3~
## 3 googledocs_test.Rmd                  1c_WN7-kYO8QwxDab0alNqth~ <named list [3~
## 4 Searchable table of businesses boyc~ 1S-hoVR1hsLMYAxvPUGDYhT8~ <named list [3~
## 5 BestStorage-South_CreditCardExpirat~ 1_zBZKeVUV4MuwC_MxwBLS9C~ <named list [3~
df <- read_sheet("https://docs.google.com/spreadsheets/d/1t5lvReGpx6SqMbYZiOuh8V-8sZVZ6hKcDRTvgHc2MH0/edit#gid=0")
## > Using an auto-discovered, cached token
##   To suppress this message, modify your code or options to clearly consent to
##   the use of a cached token
##   See gargle's "Non-interactive auth" vignette for more details:
##   <https://gargle.r-lib.org/articles/non-interactive-auth.html>
## > The googlesheets4 package is using a cached token for 'gbbuck@gmail.com'
## Reading from "DIDSON_Catalog"
## Range "DIDSON Inventory"
ggplot(df,aes(x = freq, y = sizekb)) +
  geom_bar(stat = "identity")