Learn R Programming

rock (version 0.9.6)

import_source_from_gDocs: Import a source from Google Documents

Description

Import a source from Google Documents

Usage

import_source_from_gDocs(x, localFile = NULL)

Value

The source contents.

Arguments

x

The URL to the source: has to be viewable publicly!

localFile

A local file (where to store a local backup).

Examples

Run this code
### Note that this will require an active
### internet connection! This if statement
### checks for that.
# \donttest{
if (tryCatch({readLines("https://google.com",n=1); TRUE}, error=function(x) FALSE)) {

  gDocs_url <-
    paste0(
      "https://docs.google.com/document/d/",
      "1iACYjV7DdCjOmfgX6KEMtCcCjuuXD3iuikTSGWtsK84",
      "/edit?usp=sharing"
    );

  ### Import the source
  exampleSource <-
    import_source_from_gDocs(
      gDocs_url
    );

  ### Show the downloaded file:
  exampleSource;

  ### Parse the source:
  parsedExampleSource <-
    rock::parse_source(
      exampleSource
    );

  ### Imported; the comments are gone:
  parsedExampleSource$qdt$utterances_raw;
}
# }

Run the code above in your browser using DataLab