R - 如何获取/打印从任何包/库例如:ISLR加载的数据集中的变量描述?

问题描述

是否有一个函数可以打印关于作为从库或包加载的数据集的一部分的变量的描述/详细信息(变量代表什么,它的单位是什么等)?

注意:我使用的是 jupyter notebook。

有没有办法检查数据集是否有内置信息?

我已经从图书馆 (ISLR) 中加载了“R 统计学习简介”一书的数据集。

我想查看“大学”数据集中包含的变量的描述,例如:Top10perc、Outstate 等。

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

例如:
(从包 ISLR 的 pdf 获得此描述)

__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

解决方法

它们通常记录在帮助文件中。例如,要获取有关 Auto 数据集的文档:

library(ISLR)
?Auto

这将显示所有帮助文件,您可以单击以获取更多信息。

help(packages = "ISLR")

或者,帮助文件被组装成参考手册,可以在包的 CRAN 主页上轻松访问,例如https://cran.r-project.org/package=ISLR

,

这应该对你有帮助

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...