Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit48ad5e4

Browse files
committed
Fixes to make sure it still works without readr
1 parent5aa0bee commit48ad5e4

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

‎R/construct_download_url.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#' # Download a sheet manually using readr
1414
#' url <- 'docs.google.com/spreadsheets/d/1I9mJsS5QnXF2TNNntTy-HrcdHmIF9wJ8ONYvEJTXSNo'
1515
#'
16-
#' if(requireNamespace('readr')){
16+
#' if(requireNamespace('readr', quietly=TRUE)){
1717
#' library(readr)
1818
#' read_csv(construct_download_url(url), col_types = cols(
1919
#' mpg = col_double(),

‎R/gsheet2tbl.R‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#' read.csv(text=gsheet2text(url, format='csv'), stringsAsFactors=FALSE)
3737
#'
3838
#' # Or, with readr:
39-
#' if(requireNamespace('readr')){
39+
#' if(requireNamespace('readr', quietly=TRUE)){
4040
#' library(readr)
4141
#' read_csv(construct_download_url(url), col_types = cols(
4242
#' mpg = col_double(),
@@ -54,7 +54,7 @@
5454
#' }
5555
#'
5656
gsheet2tbl<-function(url,sheetid=NULL){
57-
if(requireNamespace('readr')){
57+
if(requireNamespace('readr',quietly=TRUE)){
5858
suppressMessages(table<-readr::read_csv(file= construct_download_url(url,format='csv',sheetid=NULL)))
5959
}else{
6060
table<-utils::read.csv(text=gsheet2text(url=url,format='csv',sheetid=sheetid),stringsAsFactors=FALSE)

‎man/construct_download_url.Rd‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎man/gsheet2tbl.Rd‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎tests/testthat/test-gsheet2tbl.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ test_that('Works correctly with and with url containing sheetid = 850032961', {
1313

1414
test_that('Correct result on corner cases sheet', {
1515
a<- gsheet2tbl('https://docs.google.com/spreadsheets/d/1QNaOSRePfMRpdyR6DQfdO82pAq9RRrlJeK6DP3ZlMCg/edit?usp=sharing')
16-
expect_equal(a[1,][['case']],'<test>hello')
16+
expect_equal(a[1,'case'] %>% as.character(),'<test>hello')
1717
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp