为什么此代码显示dwapi :: configure()?

时间:2019-09-16 04:49:36

标签: r

如何正确获取此代码?

library("data.world")
file_df <- download_file_as_data_frame(
  "jonloyens/an-intro-to-dataworld-dataset",
  "fatal-police-shootings-data.csv")
  

auth_token()中的错误:必须先配置API身份验证,然后才能调用任何功能。要配置,请使用dwapi :: configure()。

2 个答案:

答案 0 :(得分:1)

为了说明为什么我写了这个评论:

packageDescription('data.world')
Package: data.world
Title: Functions and Add-Ins for Working with 'data.world' Data Sets and Projects
Version: 1.2.2
Authors@R: c( person("Rafael", "Pereira", email = "rafael.pereira@data.world", role =
         c("aut", "cre")), person("Triet", "Le", email = "triet.le@data.world", role =
         c("aut")), person("Bryon", "Jacob", email = "bryon.jacob@data.world", role =
         c("aut")), person("Scott", "Came", email = "scott@cascadia-analytics.com",
         role = c("aut")))
Description: High-level tools for working with 'data.world' data sets. 'data.world' is
         a platform where you can find interesting data, store and showcase your own
         data and data projects, and find and collaborate with other members. In
         addition to exploring, querying and charting data on the data.world site, you
         can access data via 'API' endpoints and integrations. Use this package to
         access, query and explore data sets, and to publish your insights. Visit
         <https://data.world>, for additional information.
Depends: R (>= 3.3.0), dwapi (>= 0.1.3)
Imports: httr, ini, miniUI, shiny, stringi
Suggests: covr, knitr, lintr, readr, rmarkdown, testthat (>= 2.0.0)
License: Apache License 2.0
Encoding: UTF-8
LazyData: true
URL: https://github.com/datadotworld/data.world-r
BugReports: https://github.com/datadotworld/data.world-r/issues
RoxygenNote: 6.0.1
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2018-04-04 20:36:39 UTC; root
Author: Rafael Pereira [aut, cre], Triet Le [aut], Bryon Jacob [aut], Scott Came [aut]
Maintainer: Rafael Pereira <rafael.pereira@data.world>
Repository: CRAN
Date/Publication: 2018-04-04 22:29:14 UTC
Built: R 3.6.1; ; 2019-09-16 05:09:34 UTC; unix

CRAN接受的每个软件包都需要一个Description文件,该文件显示了如何从控制台进行访问。这是具有特定要求的文本文件。功能之一是将您指向成功运行所需的其他软件包,以及外部代码源(在这种情况下为数据)。因此,您应该转到“ URL:”行的值,即。 https://github.com/datadotworld/data.world-r并进行自我教育。有时您可能需要安装系统软件包,尽管此特定软件包未列出任何软件包。

答案 1 :(得分:0)

dwapi::configure()的文档可以在Github上的自述文件的Configuration部分中找到。

简而言之,对data.world API的请求需要用户令牌(甚至是免费的用户令牌),并且错误表明令牌未正确发送。