如何查看R中可获取的数据集有哪些?

Once you start your R program, there are example data sets available within R along with loaded packages.  You can list the data sets by their names and then load a data set into memory to be used in your statistical analysis. For example, in the book " Modern Applied Statistics with S" a data set called  phones is used in Chapter 6 for robust regression and we want to use the same data set for our own examples. Here is how to locate the data set and load it into R.
Command  library loads the package MASS (for Modern Applied Statistics with S) into memory. Command  data() will list all the datasets in loaded packages. The command  data(phones) will load the data set  phones into memory.
library(MASS)
data()

Data sets in package 'datasets':
AirPassengers           Monthly Airline Passenger Numbers 1949-1960
BJsales                 Sales Data with Leading Indicator
BJsales.lead (BJsales)
                        Sales Data with Leading Indicator
BOD                     Biochemical Oxygen Demand
CO2                     Carbon Dioxide uptake in grass plants
ChickWeight             Weight versus age of chicks on different diets
DNase                   Elisa assay of DNase
EuStockMarkets          Daily Closing Prices of Major European Stock
                        Indices, 1991-1998
........ (more data sets in between are omitted.)
uspop                   Populations Recorded by the US Census
volcano                 Topographic Information on Auckland's Maunga
                        Whau Volcano
warpbreaks              The Number of Breaks in Yarn during Weaving
women                   Average Heights and Weights for American Women
Data sets in package 'MASS':
Aids2                   Australian AIDS Survival Data
Animals                 Brain and Body Weights for 28 Species
... (more data sets are omitted here)
oats                    Data from an Oats Field Trial
painters                The Painter's Data of de Piles
petrol                  N. L. Prater's Petrol Refinery Data
phones                  Belgium Phone Calls 1950-1973
quine                   Absenteeism from School in Rural New South
                        Wales
... (more data sets are omitted here)

Use 'data(package = .packages(all.available = TRUE))'
to list the data sets in all *available* packages.

data(phones)

phones

$year
 [1] 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
$calls
 [1]   4.4   4.7   4.7   5.9   6.6   7.3   8.1   8.8  10.6  12.0  13.5  14.9
[13]  16.1  21.2 119.0 124.0 142.0 159.0 182.0 212.0  43.0  24.0  27.0  29.0
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
R语言可以用来分析鸢尾花数据集。通过使用R语言的各种统计和机器学习函数和库,可以进行数据探索、数据可视化、分类模型的建立和预测等分析。 首先,在R语言可以使用一些基本的函数来加载和查看鸢尾花数据集。可以使用read.csv()函数将数据集导入到R环境,并使用head()函数查看前几行数据。这样可以对数据集的结构和字段有一个初步的了解。 然后,可以使用R语言的各种统计函数和图形库来进行数据探索和可视化。例如,可以使用summary()函数来获取关于数据集每个变量的统计摘要信息,如均值、位数、最小值和最大值等。同时,可以使用hist()函数、boxplot()函数和scatterplot()函数等来绘制数据的直方图、箱线图和散点图等,以更直观地理解数据的分布和关系。 接下来,可以使用R语言的机器学习函数和库来建立分类模型。例如,可以使用逻辑回归函数glm()来训练一个二分类模型,将鸢尾花数据集的物种进行预测。可以将Virginica和versicolor分别表示为0和1,并使用模型来预测新的观测结果的物种类别。 最后,可以使用R语言的评估函数来评估模型的性能。例如,可以使用confusionMatrix()函数来计算模型的准确性、召回率、精确率等指标,以评估模型的分类效果。 总之,R语言可以提供丰富的函数和库来分析鸢尾花数据集,包括数据探索、数据可视化、分类模型的建立和评估等方面。通过使用这些工具和技术,可以深入研究鸢尾花数据集并进行相关分析和诊断,以建立一个能够对新观察结果进行分类的模型。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值