简体   繁体   中英

fetchData function no longer in mosaic package

I am using R 3.2.2 and installed the mosaic package. I then used the fetchData function as follows:

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

I get the following error:

Error: Use fetchData() from the `fetch' package instead.

When I try to install the fetch package, an error says:

Warning in install.packages : package 'fetch' is not available (for R version 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.

Fetch

It appears that the fetch package is currently available via GitHub at https://github.com/ProjectMOSAIC/fetch .

Installation

To install fetch from GitHub:

  1. Open up your R console
  2. Install devtools (if not already installed) with this command *:

    install.packages("devtools")

  3. Type y if going through the devtools installer

  4. Install fetch with this command :

    devtools::install_github("ProjectMOSAIC/fetch")

Basic Usage

If successful, fetch should be accessible by requiring the fetch package

require("ProjectMOSAIC/fetch")

and calling fetchData() like this:

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.

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. The workflow that we have been using to get around this (slightly simpler than summea's answer) is:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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