我安装了googlesheets包和
code:
gs_auth()
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
浏览器会弹出一个空白网站,而不是google身份验证页面。
以下是我的session_info():
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.1
Matrix products: default
BLAS:
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK:/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] googlesheets_0.2.2 Rcpp_0.12.14 ggplot2_2.2.1
quantmod_0.4-11
[5] TTR_0.23-2 xts_0.10-0 zoo_1.8-0
dplyr_0.7.4
[9] data.table_1.10.4-3 bindrcpp_0.2
alphavantager_0.1.0.9000 devtools_1.13.4
loaded via a namespace (and not attached):
[1] cellranger_1.1.0 compiler_3.4.2 git2r_0.19.0 plyr_1.8.4
bindr_0.1
[6] tools_3.4.2 digest_0.6.12 jsonlite_1.5 memoise_1.1.0
tibble_1.3.4
[11] gtable_0.2.0 lattice_0.20-35 pkgconfig_2.0.1 rlang_0.1.4
curl_3.0
[16] xml2_1.1.1 withr_2.1.0 httr_1.3.1 stringr_1.2.0
knitr_1.17
[21] hms_0.4.0 grid_3.4.2 glue_1.2.0 R6_2.2.2
purrr_0.2.4
[26] readr_1.1.1 magrittr_1.5 scales_0.5.0
assertthat_0.2.0 colorspace_1.3-2
[31] httpuv_1.3.5 stringi_1.1.6 openssl_0.9.9 lazyeval_0.2.1
munsell_0.4.3
我检查过我的httr包已更新,所以我不知道问题出在哪里。请建议。
感谢。
答案 0 :(得分:1)
根据gs_auth()
的R帮助,最终用户通常不会直接调用此函数。相反,当需要通过Google进行身份验证时,googlesheets
包中的其他功能会调用它。
相反,如果您尝试从Google帐户获取工作表列表,则会要求您使用Google帐户进行身份验证。例如:
mySheetList <- gs_ls()
...将启动一个登录序列,要求您剪切&amp;将身份验证URL粘贴到Web浏览器中。后续步骤生成一个令牌,粘贴回R控制台进行身份验证。
有关如何对Google表格进行身份验证的屏幕截图的详细信息,请参阅我的文章在Chromebook上运行R和RStudio 的Working with Google Sheets部分。
这是一个R控制台日志,包括sessionInfo()
,说明了所使用的软件包和版本。
> library(googlesheets)
> theSheetList <- gs_ls()
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
> theSheetList
# A tibble: 1 x 10
sheet_title author perm version updated sheet_key
<chr> <chr> <chr> <chr> <dttm> <chr>
1 PokemonStats greskilabs rw new 2017-07-08 22:40:15 13rGxY7S…
# ... with 4 more variables: ws_feed <chr>, alternate <chr>, self <chr>, alt_key <chr>
>
> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] googlesheets_0.2.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.13 dplyr_0.7.4 assertthat_0.2.0 cellranger_1.1.0 R6_2.2.2 jsonlite_1.5 magrittr_1.5
[8] httr_1.3.1 stringi_1.1.5 rlang_0.1.2 curl_3.0 bindrcpp_0.2 xml2_1.1.1 tools_3.4.2
[15] stringr_1.2.0 glue_1.1.1 purrr_0.2.4 httpuv_1.3.5 yaml_2.1.14 compiler_3.4.2 pkgconfig_2.0.1
[22] openssl_0.9.7 bindr_0.1 tibble_1.3.4
>
答案 1 :(得分:0)
这是Chrome浏览器的问题,而不是任何R软件包,我已经在Firefox中进行了测试,并在Mac上进行了Safari测试,可以成功连接Google工作表。