如何解决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 举报,一经查实,本站将立刻删除。