rahul-ahuja
rahul-ahuja

Reputation: 1424

R - How to get/print description of the variables in a dataset loaded from any package / library (eg: ISLR)?

Is there a function that can print the description / detailed info (what does a variable represent, what are it's units etc.) about the variables that are part of a dataset loaded from a library or package?

Note: I am using jupyter notebook.

Is there a way to check if a dataset has in-built info?

I have loaded the datasets from the library (ISLR) for the book "Introduction to Statistical Learning with R."

I want to see the description of the variables included in the 'College' dataset like : Top10perc, Outstate, etc.

# load library
library(ISLR)
df = College        # saved data with a generic name 'df'

For ex:
(got this description from a pdf for the package ISLR)

__College__   
U.S. News and World Report’s College Data

__Description__   
Statistics for a large number of US Colleges from the 1995 issue of US News and World Report.

__Format__ 
A data frame with 777 observations on the following 18 variables.

Private A factor with levels No and Yes indicating private or public university
Apps Number of applications received
Accept Number of applications accepted
Enroll Number of new students enrolled
Top10perc Pct. new students from top 10% of H.S. class
Top25perc Pct. new students from top 25% of H.S. class
F.Undergrad Number of fulltime undergraduates
P.Undergrad Number of parttime undergraduates
Outstate Out-of-state tuition
Room.Board Room and board costs
Books Estimated book costs
Personal Estimated personal spending
PhD Pct. of faculty with Ph.D.’s
Terminal Pct. of faculty with terminal degree
S.F.Ratio Student/faculty ratio
perc.alumni Pct. alumni who donate
Expend Instructional expenditure per student
Grad.Rate Graduation rate

Upvotes: 1

Views: 1726

Answers (2)

Simon
Simon

Reputation: 11

This should help you

```{r}
library(ISLR)
?ISLR
```

Upvotes: 1

G. Grothendieck
G. Grothendieck

Reputation: 270055

They are typically documented in help files. For example, to get the documentation on the Auto data set:

library(ISLR)
?Auto

This will show all of the help files and you can click through to get more information.

help(packages = "ISLR")

Alternately, the help files are assembled into a Reference Manual and that can be readily accessed on the CRAN home page of the package, e.g. https://cran.r-project.org/package=ISLR

Upvotes: 3

Related Questions