0
$\begingroup$

The Python statsmodels library grants access to many R-datasets which can be downloaded e.g. with:

import statsmodels.api as sm
df = sm.datasets.get_rdataset(dataname='iris', package='datasets').data

But for this you have to know the id or the name of the dataset.

sm.datasets.get_rdataset??
Signature: sm.datasets.get_rdataset(dataname, package='datasets', cache=False)
Source:   
def get_rdataset(dataname, package="datasets", cache=False):
    """download and return R dataset

    Parameters
    ----------
    dataname : str
        The name of the dataset you want to download

There is a list of available datasets here, but this list does not contain the identifiers. Also not the detailed view.

Is there an overview of all the available datasets that contains the ids e.g. "iris"?

There is an index that is supposed to list all the datasets, but e.g. 'rice' as a name does not work.

$\endgroup$
  • $\begingroup$ You can search the index page with the internet browser which finds a “rice” dataset $\endgroup$ – Josef Dec 13 '19 at 13:56
  • $\begingroup$ I am more asking for a list of keywords that I can pass into get_rdataset that work. $\endgroup$ – Sören Dec 13 '19 at 15:07
0
$\begingroup$

Here is the website of the creator of rdatasets I guess with the info you are looking for:

http://vincentarelbundock.github.io/Rdatasets/datasets.html

Here is a short look at it:

Package     Item    Title   Rows    Cols    n_binary    n_character     n_factor    n_logical   n_numeric   CSV     Doc
boot    acme    Monthly Excess Returns  60  3   0   1   0   0   2   CSV     DOC
boot    aids    Delay in AIDS Reporting in England and Wales    570     6   1   0   0   0   6   CSV     DOC
boot    aircondit   Failures of Air-conditioning Equipment  12  1   0   0   0   0   1   CSV     DOC
boot    aircondit7  Failures of Air-conditioning Equipment  24  1   0   0   0   0   1   CSV     DOC
boot    amis    Car Speeding and Warning Signs  8437    4   1   0   0   0   4   CSV     DOC
boot    aml     Remission Times for Acute Myelogenous Leukaemia     23  3   2   0   0   0   3   CSV     DOC 
...

I assume the Item column are the identifiers.

$\endgroup$
  • $\begingroup$ As stated above, that does not seem to work. Try for example 'rice'. $\endgroup$ – Sören Dec 20 '19 at 14:15
  • $\begingroup$ Did you change the package parameter to DAAG for the dataset rice? Since it’s not in the package datasets according to the index site. $\endgroup$ – voiDnyx Dec 22 '19 at 11:18
0
$\begingroup$

You can view all the available datasets at this URL https://github.com/vincentarelbundock/Rdatasets/blob/master/datasets.csv

The available ones in statsmodels are those with the tag datasets which looks like line 372 - 455.

I didn't test them all, but everyone I tried from a small random sample seemed to work fine.

New contributor
andrewnc is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.