简体   繁体   English

fetchData函数不再在马赛克包中

[英]fetchData function no longer in mosaic package

I am using R 3.2.2 and installed the mosaic package. 我正在使用R 3.2.2并安装了mosaic包。 I then used the fetchData function as follows: 然后我使用fetchData函数如下:

data<-fetchData(1,c("Web_scraping","Data_mining")) 

I get the following error: 我收到以下错误:

Error: Use fetchData() from the `fetch' package instead. 错误:改为使用`fetch'包中的fetchData()。

When I try to install the fetch package, an error says: 当我尝试安装fetch包时,出现错误:

Warning in install.packages : package 'fetch' is not available (for R version 3.2.2) install.packages中的警告:包'fetch'不可用(对于R版本3.2.2)

I found documentation that the mosaic package was dropping fetchData in R 3.2.2, but couldn't find what package I should use to run the function properly. 我发现mosaic软件包在R 3.2.2中删除了fetchData文档,但找不到我应该用来正确运行该函数的软件包。

Fetch

It appears that the fetch package is currently available via GitHub at https://github.com/ProjectMOSAIC/fetch . 看来fetch包目前可以通过https://github.com/ProjectMOSAIC/fetch上的GitHub获得。

Installation 安装

To install fetch from GitHub: 要从GitHub安装fetch

  1. Open up your R console 打开你的R控制台
  2. Install devtools (if not already installed) with this command *: 使用此命令安装devtools (如果尚未安装) *:

    install.packages("devtools")

  3. Type y if going through the devtools installer 如果通过devtools安装程序输入y

  4. Install fetch with this command : 使用以下命令安装fetch

    devtools::install_github("ProjectMOSAIC/fetch")

Basic Usage 基本用法

If successful, fetch should be accessible by requiring the fetch package 如果成功, fetch应该可以访问通过要求fetch

require("ProjectMOSAIC/fetch")

and calling fetchData() like this: 并像这样调用fetchData()

data <- fetch::fetchData( ... )

* Note: According to Etienne Low-Décarie , you'll need to have the make command available on your system before running the install.packages("devtools") command. * 注意: 根据Etienne Low-Décarie的说法,在运行install.packages("devtools")命令之前,您需要在系统上使用make命令。

My students have been running into this problem trying to use the textbook code from Statistical Modeling: A Fresh Approach, this semester. 我的学生在本学期试图使用统计建模:一种新方法的教科书代码时遇到了这个问题。 I'm not familiar with the syntax used in the original question (with the number as the first argument), but this does not appear to be supported syntax in the fetch::fetchData() function. 我不熟悉原始问题中使用的语法(数字作为第一个参数),但这似乎不是fetch::fetchData()函数中支持的语法。 The workflow that we have been using to get around this (slightly simpler than summea's answer) is: 我们一直用来解决这个问题的工作流程(比summea的答案稍微简单)是:

install.packages("devtools")
devtools::install_github("ProjectMOSAIC/fetch")
data <- fetch::fetchData("whickham.csv")

Note that I cannot reproduce the example in the original question, as I get different error/warning messages: 请注意,我无法在原始问题中重现该示例,因为我收到不同的错误/警告消息:

data<-fetch::fetchData(1,c("Web_scraping","Data_mining")) 

With this as the error/warning: 将此作为错误/警告:

Error in if (show.path) return(get("path", envir = .fetchEnvironment)) : 
  argument is not interpretable as logical
In addition: Warning message:
In if (show.path) return(get("path", envir = .fetchEnvironment)) :
  the condition has length > 1 and only the first element will be used

I hope fetch is on its way to being on CRAN, and listed as a dependency of mosaic, as this is currently causing headaches in my class. 我希望fetch正在进入CRAN,并被列为马赛克的依赖,因为这目前在我的班级引起了头痛。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM