微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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
```

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?