title: How to write R dataframe to a Google Cloud Storage bucket folder
body: <p>I want to write R dataframe to Google Cloud Storage bucket. I am using <code>googleCloudStorageR</code> library in R and here is my code -</p>
  
  <pre><code>################### START ###############################
  
  options(googleAuthR.scopes.selected = "https://www.googleapis.com/auth/cloud-platform")
  # load the libraries
  library("googleAuthR", lib.loc="/home/user/packages" )
  library("googleCloudStorageR", lib.loc="/home/user/packages")
  gar_gce_auth()
  
  
  name &lt;- c("john","doe")
  id &lt;- c(1,2)
  results = as.data.frame(cbind(name,id))
  print("writing results to GCS")
  
  # Set bucket name
  bucket &lt;- "my-bucket"
  gcs_global_bucket(bucket)
  print("bucket set.")
  
  
  # Upload that file to the global bucket
  gcs_upload(file = results , name = "results.csv")
  
  ################## END ################################
  </code></pre>
  
  <p>This loads the dataframe to bucket <code>my-bucket</code>. </p>
  
  <p>Now I want to save this same dataframe but to a different folder structure, for example - <code>my-bucket\my-folder\results.csv</code> . How can I save the dataframe to this new path in GCS ?</p>
  
  <p><a href="https://cran.r-project.org/web/packages/googleCloudStorageR/googleCloudStorageR.pdf" rel="nofollow noreferrer">https://cran.r-project.org/web/packages/googleCloudStorageR/googleCloudStorageR.pdf</a></p>