knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE )
The allofus
package includes several functions designed to help you manage and transfer files between your personal workspace and a shared bucket in Google BigQuery. Understanding the difference between these two storage locations is crucial:
Use aou_ls_workspace()
to list files in your workspace. This function is handy for quickly checking which files you have stored locally.
aou_ls_workspace()
Similarly, aou_ls_bucket()
lists files in your bucket. This function can be used to view files that you or your collaborators have saved for shared access.
aou_ls_bucket()
You can also use the pattern
argument with these functions to filter the listed files based on a naming pattern.
aou_ls_workspace(pattern = "*.csv") aou_ls_bucket(pattern = "project_*.csv")
These functions are used in conjunction with R's reading and writing functions. You can store any type of data in both the workspace and the bucket.
Once you've processed or created a file in your workspace, you might want to move it to the bucket for permanent storage or to share it with collaborators. Use aou_workspace_to_bucket()
for this purpose.
write.csv(data, "file1.csv") aou_workspace_to_bucket("file1.csv")
If you need to use a file that a collaborator has saved to the bucket, or if you want to retrieve a file after deleting your environment, use aou_bucket_to_workspace()
.
aou_bucket_to_workspace("file2.csv") data <- read.csv("file2.csv")
Here’s a typical workflow using these functions:
write.csv()
or write.rds()
. aou_workspace_to_bucket()
. aou_bucket_to_workspace()
to bring files into your workspace as needed.Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.