gpt4 book ai didi

r - 如何正确使用 require(googlesheets)?

转载 作者:行者123 更新时间:2023-12-04 11:32:36 26 4
gpt4 key购买 nike

我最近下载了 googlesheets通过

devtools::install_github("jennybc/googlesheets")

并遇到一些困难。运行脚本时
https://github.com/jennybc/googlesheets我总是得到:
Error: could not find function "%>%"

我该如何解决这个问题?

可重现的例子:

下载:
devtools::install_github("jennybc/googlesheets")
require(googlesheets)

数据:
gap_key <- "1HT5B8SgkKqHdqHJmn5xiuaC04Ngb7dG9Tv94004vezA"
copy_ss(key = gap_key, to = "Gapminder")
gap <- register_ss("Gapminder")

发生错误:
oceania_csv <- gap %>% get_via_csv(ws = "Oceania")

最佳答案

加载 dplyr首先包,它提供了 %>%运算符(operator)。这是注明here在您链接到的自述文件中(suppressMessages 是可选的):

googlesheets is designed for use with the %>% pipe operator and, to a lesser extent, the data-wrangling mentality of dplyr. The examples here use both, but we'll soon develop a vignette that shows usage with plain vanilla R. googlesheets uses dplyr internally but does not require the user to do so.


library("googlesheets")
suppressMessages(library("dplyr"))

您可以安装 dplyr
install.packages("dplyr")

here有关管道运算符 ( %>% ) 的更多信息。

关于r - 如何正确使用 require(googlesheets)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29899334/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com