This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
admit that I must deal with visibility [covr]
- Loading branch information
jennybc
committed
Mar 30, 2015
1 parent
cd1edc9
commit 7b38a14
Showing
13 changed files
with
92 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#' --- | ||
#' output: md_document | ||
#' --- | ||
|
||
library("googlesheets") | ||
suppressPackageStartupMessages(library("dplyr")) | ||
|
||
## damn you render and your hard-wiring of wd = dir where file lives! | ||
## if I don't commit this abomination, existing .httr-oauth cannot be found :( | ||
if (getwd() %>% basename == "data-for-demo") { | ||
setwd("..") | ||
} | ||
|
||
## "make clean" | ||
delete_ss(regex = "^iris_public$") | ||
|
||
iris_ss <- new_ss("iris_public") | ||
iris_ss | ||
|
||
iris_ss <- iris_ss %>% | ||
edit_cells(input = head(iris), header = TRUE, trim = TRUE) | ||
iris_ss | ||
|
||
iris_ss %>% get_via_lf() | ||
iris_ss %>% get_via_csv() | ||
|
||
## via browser, publish this sheet to the web | ||
## in sheets, File > Publish to the web ... | ||
## in future, do programmatically w/ googlesheets or driver | ||
## https://github.com/jennybc/googlesheets/issues/62 | ||
## https://docs.google.com/spreadsheets/d/1cAYN-a089TSw8GF0RadQNdZiWo2RzekT-8swZeYME4A/pubhtml | ||
|
||
iris_key <- "1cAYN-a089TSw8GF0RadQNdZiWo2RzekT-8swZeYME4A" | ||
iris_public <- register_ss(key = iris_key, visibility = "public") | ||
iris_public | ||
iris_public %>% get_via_csv() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
context("Downloading spreadsheets") | ||
context("download sheets") | ||
|
||
test_that("Spreadsheet can be exported", { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
context("edit spreadsheets") | ||
context("edit sheets") | ||
|
||
test_that("Spreadsheet can be created and deleted", { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
context("consume data WITHOUT authenticating") | ||
## this is a separate file, with a name that is alphabetically last, because I | ||
## want to change working directory, w/o wrecking other tests | ||
|
||
temp_dir <- tempdir() | ||
old_wd <- setwd(temp_dir) | ||
|
||
iris_public <- register_ss(key = ptw_key, visibility = "public") | ||
|
||
iris_ish <- iris %>% head(6) | ||
## because our data consumption m.o. is stringsAsFactors = FALSE | ||
iris_ish$Species <- iris_ish$Species %>% as.character() | ||
|
||
test_that("We can get data 'published to the web' sheet w/o authenticating, via csv", { | ||
|
||
tmp <- iris_public %>% get_via_csv() | ||
expect_equivalent(tmp, iris_ish) | ||
|
||
}) | ||
|
||
test_that("We can get data 'published to the web' w/o authenticating, via list feed", { | ||
|
||
iris_ish2 <- iris_ish | ||
## because the list feed will lowercase the names | ||
names(iris_ish2) <- names(iris_ish2) %>% tolower() | ||
|
||
tmp <- iris_public %>% get_via_lf() | ||
expect_equivalent(tmp, iris_ish) | ||
|
||
|
||
}) | ||
|
||
setwd(old_wd) |