0

I'm working with topicmodels package:

library(topicmodels)
library(tm)

I tried to load the NYTimes dataset. But:

data(NYTimes)

returns the error:

Warning message:
In data(NYTimes) : data set ‘NYTimes’ not found

I took this code from a textbook on R.

s_baldur
  • 29,441
  • 4
  • 36
  • 69
Mark
  • 1,577
  • 16
  • 43
  • That data set does not exist in any of the libraries you mention. Maybe go back at the textbook and find the source – Sotos Feb 06 '20 at 07:58
  • The package containing that dataset is `RTextTools` which has been archived on CRAN. See [here](https://stackoverflow.com/questions/24194409/how-do-i-install-a-package-that-has-been-archived-from-cran) for how to install an archived package. – Ritchie Sacramento Feb 06 '20 at 08:06
  • That dataset is described as "a sample dataset containing labeled headlines from The New York Times" in both package [RTextTools](https://cran.r-project.org/web/packages/RTextTools/index.html) and package [maxent](https://cran.r-project.org/web/packages/maxent/index.html). Both packages were removed from the CRAN repository. – Rui Barradas Feb 06 '20 at 08:07

2 Answers2

2

I guess you meant "... tried to download ...". (not upload). And that's not an error, it's a warning. Anyway, ...

You need to load the package that contains that particular dataset, NYTimes.

A quick search of the CRAN website says the data is in the RTextTools package, which has unfortunately been archived. Try the GitHub website: https://github.com/cran/RTextTools/

IRTFM
  • 258,963
  • 21
  • 364
  • 487
Edward
  • 10,360
  • 2
  • 11
  • 26
1

If you do a Google search with the terms"CRAN" data(NYTimes), you should quickly find that the "RTextTools" package has a dataset by that name.

A bit of further searching yields this information at CRAN:

Package ‘RTextTools’ was removed from the CRAN repository.

Formerly available versions can be obtained from the archive.

Archived on 2019-03-05 as depends on archived package 'maxent' by the same non-maintainer.

So go to the Package Archive for RTextTools, download it, check to see if it needs to be compiled (it doesn't), and install with the argument repo set to NULL. See ?install.packages for further details. That turns out not to work since attempts to install pkg:maxent fail at the compiling process.

The other option would be to download, unzip, navigate to the ../data/ directory inside the expanded package directory and then also unzip the compacted file by that name (with a .csv extension).

Edwards suggestion is also feasible in which case you can go directly to https://github.com/cran/RTextTools/blob/master/data/NYTimes.csv.gz and download and unzip the file without the need to install the package.

IRTFM
  • 258,963
  • 21
  • 364
  • 487