R包自带数据汇总(自带数据包:datasets)

引言

R语言基础包datasets里自带了一部分数据集合,为了大家更好的使用这些数据,这里从原子向量、因子、矩阵、数组、类矩阵、数据框、类数据框、列表、时间序列等9个方面做一些总结和介绍。大家可以通过data()命令获取全部的数据集列表。
根据维度进行简单的分类如下表。

维度数据类型
1维原子向量(1)、因子(2)、列表(7)、一维时间序列(8.1)
2维矩阵(3)、类矩阵(4)、数据框(5)、类数据框(6)、多维时间序列(8.2)
n维数组(9)

注:括号中的数字是文章对应的章节,方便查找索引用的。类矩阵虽然是放在矩阵列里,但是实际没有维度信息。

常用数据整理(仅代表个人观点,如有其他见解欢迎留言):

数据名称(R语言)数据类型维度章节常用模型推荐星级
crimta矩阵、table二维(42x22)3.8双指标分布可视化三星
Harman23.cor类矩阵、list4.2相关系数图三星
airquality数据框二维(153*6)5.1可视化、回归四星
anscombe数据框二维(11*6)5.2回归、统计分析五星
chickwts数据框二维(71*2)5.8一元回归四星
airmiles时间序列8.1.1一元时间序列四星
EuStockMarkets时间序列二维(1860*4)8.2.1多元时间序列五星
iris3数组三维(50x4x3)9.1分类模型五星
Titanic数组、table四维(4x2x2x2)9.2高维数据索引四星
HairEyeColor数组、table三维(4x2x2)9.4高维数据索引四星

1、原子向量 + 条形图(一维)

1.1 欧元货币换算率

数据名字:euro(R语言)
数据名称:欧元货币换算率
数据长度:11
数据示例:

> euro 
        ATS         BEF         DEM         ESP         FIM         FRF 
  13.760300   40.339900    1.955830  166.386000    5.945730    6.559570 
        IEP         ITL         LUF         NLG         PTE 
   0.787564 1936.270000   40.339900    2.203710  200.482000 
> str(euro)    
 Named num [1:11] 13.76 40.34 1.96 166.39 5.95 ...
 - attr(*, "names")= chr [1:11] "ATS" "BEF" "DEM" "ESP" ...

在这里插入图片描述

1.2 美国城市年降水量

数据名字:precip(R语言)
数据名称: 美国城市年降水量
数据长度:70
数据示例:

> precip
             Mobile              Juneau             Phoenix 
               67.0                54.7                 7.0 
        Little Rock         Los Angeles          Sacramento 
               48.5                14.0                17.2 
      San Francisco              Denver            Hartford 
               20.7                13.0                43.4 
         Wilmington          Washington        Jacksonville 
               40.2                38.9                54.5 
              Miami             Atlanta            Honolulu 
               59.8                48.3                22.9 
              Boise             Chicago              Peoria 
               11.5                34.4                35.1 
       Indianapolis          Des Moines             Wichita 
               38.7                30.8                30.6 
         Louisville         New Orleans            Portland 
               43.1                56.8                40.8 
          Baltimore              Boston             Detroit 
               41.8                42.5                31.0 
   Sault Ste. Marie              Duluth Minneapolis/St Paul 
               31.7                30.2                25.9 
            Jackson         Kansas City            St Louis 
               49.2                37.0                35.9 
        Great Falls               Omaha                Reno 
               15.0                30.2                 7.2 
            Concord       Atlantic City         Albuquerque 
               36.2                45.5                 7.8 
             Albany             Buffalo            New York 
               33.4                36.1                40.2 
          Charlotte             Raleigh             Bismark 
               42.7                42.5                16.2 
         Cincinnati           Cleveland            Columbus 
               39.0                35.0                37.0 
      Oklahoma City            Portland        Philadelphia 
               31.4                37.6                39.9 
          Pittsburg          Providence            Columbia 
               36.2                42.8                46.4 
        Sioux Falls             Memphis           Nashville 
               24.7                49.1                46.0 
             Dallas             El Paso             Houston 
               35.9                 7.8                48.2 
     Salt Lake City          Burlington             Norfolk 
               15.2                32.5                44.7 
           Richmond      Seattle Tacoma             Spokane 
               42.6                38.8                17.4 
         Charleston           Milwaukee            Cheyenne 
               40.8                29.1                14.6 
           San Juan 
               59.2 
> str(precip)    
 Named num [1:70] 67 54.7 7 48.5 14 17.2 20.7 13 43.4 40.2 ...
 - attr(*, "names")= chr [1:70] "Mobile" "Juneau" "Phoenix" "Little Rock" ...

在这里插入图片描述

1.3 北美主要河流的长度(不含河流名字)

描述:This data set gives the lengths (in miles) of 141 “major” rivers in North America, as compiled by the US Geological Survey.
数据名字:rivers(R语言)
数据名称: 北美主要河流的长度
数据长度:141
数据示例:

> rivers
  [1]  735  320  325  392  524  450 1459  135  465  600  330  336  280  315
 [15]  870  906  202  329  290 1000  600  505 1450  840 1243  890  350  407
 [29]  286  280  525  720  390  250  327  230  265  850  210  630  260  230
 [43]  360  730  600  306  390  420  291  710  340  217  281  352  259  250
 [57]  470  680  570  350  300  560  900  625  332 2348 1171 3710 2315 2533
 [71]  780  280  410  460  260  255  431  350  760  618  338  981 1306  500
 [85]  696  605  250  411 1054  735  233  435  490  310  460  383  375 1270
 [99]  545  445 1885  380  300  380  377  425  276  210  800  420  350  360
[113]  538 1100 1205  314  237  610  360  540 1038  424  310  300  444  301
[127]  268  620  215  652  900  525  246  360  529  500  720  270  430  671
[141] 1770
> str(rivers)    
 num [1:141] 735 320 325 392 524 ...

在这里插入图片描述

1.4美国50个州信息(缩写、名称、全称)

数据名字:state.abb、state.area、state.name (R语言)
数据名称: 北美主要河流的长度
数据长度:50
数据示例:

> state.abb    # 缩写
 [1] "AL" "AK" "AZ" "AR" "CA" "CO" "CT" "DE" "FL" "GA" "HI" "ID" "IL" "IN"
[15] "IA" "KS" "KY" "LA" "ME" "MD" "MA" "MI" "MN" "MS" "MO" "MT" "NE" "NV"
[29] "NH" "NJ" "NM" "NY" "NC" "ND" "OH" "OK" "OR" "PA" "RI" "SC" "SD" "TN"
[43] "TX" "UT" "VT" "VA" "WA" "WV" "WI" "WY"
> state.area    # 面积
 [1]  51609 589757 113909  53104 158693 104247   5009   2057  58560  58876
[11]   6450  83557  56400  36291  56290  82264  40395  48523  33215  10577
[21]   8257  58216  84068  47716  69686 147138  77227 110540   9304   7836
[31] 121666  49576  52586  70665  41222  69919  96981  45333   1214  31055
[41]  77047  42244 267339  84916   9609  40815  68192  24181  56154  97914
> state.name    # 全称
 [1] "Alabama"        "Alaska"         "Arizona"        "Arkansas"      
 [5] "California"     "Colorado"       "Connecticut"    "Delaware"      
 [9] "Florida"        "Georgia"        "Hawaii"         "Idaho"         
[13] "Illinois"       "Indiana"        "Iowa"           "Kansas"        
[17] "Kentucky"       "Louisiana"      "Maine"          "Maryland"      
[21] "Massachusetts"  "Michigan"       "Minnesota"      "Mississippi"   
[25] "Missouri"       "Montana"        "Nebraska"       "Nevada"        
[29] "New Hampshire"  "New Jersey"     "New Mexico"     "New York"      
[33] "North Carolina" "North Dakota"   "Ohio"           "Oklahoma"      
[37] "Oregon"         "Pennsylvania"   "Rhode Island"   "South Carolina"
[41] "South Dakota"   "Tennessee"      "Texas"          "Utah"          
[45] "Vermont"        "Virginia"       "Washington"     "West Virginia" 
[49] "Wisconsin"      "Wyoming" 

2、因子 + 散点图

2.1美国50个州信息(土地类型、地理方位)

一共就两个就不设置二级目录了。每次类别的名称是1.4部分的名称。
数据长度:50
数据名称:state.division 以及 state.region (R语言)

> state.division    # 50个州的分类,9个水平
 [1] East South Central Pacific            Mountain          
 [4] West South Central Pacific            Mountain          
 [7] New England        South Atlantic     South Atlantic    
[10] South Atlantic     Pacific            Mountain          
[13] East North Central East North Central West North Central
[16] West North Central East South Central West South Central
[19] New England        South Atlantic     New England       
[22] East North Central West North Central East South Central
[25] West North Central Mountain           West North Central
[28] Mountain           New England        Middle Atlantic   
[31] Mountain           Middle Atlantic    South Atlantic    
[34] West North Central East North Central West South Central
[37] Pacific            Middle Atlantic    New England       
[40] South Atlantic     West North Central East South Central
[43] West South Central Mountain           New England       
[46] South Atlantic     Pacific            South Atlantic    
[49] East North Central Mountain          
9 Levels: New England Middle Atlantic South Atlantic ... Pacific
> str(state.division)
 Factor w/ 9 levels "New England",..: 4 9 8 5 9 8 1 3 3 3 ...
> state.region    # 50个州的地理分类,4个水平
 [1] South         West          West          South         West         
 [6] West          Northeast     South         South         South        
[11] West          West          North Central North Central North Central
[16] North Central South         South         Northeast     South        
[21] Northeast     North Central North Central South         North Central
[26] West          North Central West          Northeast     Northeast    
[31] West          Northeast     South         North Central North Central
[36] South         West          Northeast     Northeast     South        
[41] North Central South         South         West          Northeast    
[46] South         West          South         North Central West         
Levels: Northeast South North Central West
> str(state.region)
 Factor w/ 4 levels "Northeast","South",..: 2 4 4 2 4 4 1 2 2 2 ...

在这里插入图片描述
就不讲作图思路了,粘一下代码把。

ggplot(data = data.frame(division = state.division, 
region= state.region), aes(x = division, y = region)) +
geom_point()

3、矩阵

3.1 11种汇率矩阵

数据维度:11*11
数据名称:euro.cross (R语言)
数据类型:矩阵
数据展示:

> euro.cross 
             ATS         BEF         DEM         ESP         FIM         FRF          IEP         ITL         LUF         NLG         PTE
ATS  1.000000000  2.93161486 0.142135709  12.0917422 0.432093050 0.476702543 0.0572345080  140.714229  2.93161486 0.160149851  14.5695951
BEF  0.341108927  1.00000000 0.048483759   4.1246012 0.147390797 0.162607493 0.0195232016   47.998880  1.00000000 0.054628544   4.9698190
DEM  7.035529673 20.62546336 1.000000000  85.0718109 3.040003477 3.353854885 0.4026750791  989.999131 20.62546336 1.126739032 102.5048189
ESP  0.082701069  0.24244768 0.011754775   1.0000000 0.035734557 0.039423810 0.0047333550   11.637217  0.24244768 0.013244564   1.2049211
FIM  2.314316324  6.78468413 0.328946992  27.9841163 1.000000000 1.103240477 0.1324587561  325.657236  6.78468413 0.370637415  33.7186519
FRF  2.097744212  6.14977811 0.298164361  25.3653822 0.906420695 1.000000000 0.1200633578  295.182459  6.14977811 0.335953424  30.5632839
IEP 17.471976881 51.22110711 2.483391826 211.2666399 7.549519785 8.328935807 1.0000000000 2458.555749 51.22110711 2.798134501 254.5596294
ITL  0.007106602  0.02083382 0.001010102   0.0859312 0.003070713 0.003387735 0.0004067429    1.000000  0.02083382 0.001138121   0.1035403
LUF  0.341108927  1.00000000 0.048483759   4.1246012 0.147390797 0.162607493 0.0195232016   47.998880  1.00000000 0.054628544   4.9698190
NLG  6.244151907 18.30544854 0.887516960  75.5026750 2.698054644 2.976603092 0.3573809621  878.641019 18.30544854 1.000000000  90.9747653
PTE  0.068636087  0.20121457 0.009755639   0.8299299 0.029657176 0.032718997 0.0039283527    9.658074  0.20121457 0.010992059   1.0000000
> summary(euro.cross)
      ATS                 BEF                DEM               ESP                 FIM                FRF                IEP                 ITL         
 Min.   : 0.007107   Min.   : 0.02083   Min.   :0.00101   Min.   :  0.08593   Min.   :0.003071   Min.   :0.003388   Min.   :0.0004067   Min.   :   1.00  
 1st Qu.: 0.211905   1st Qu.: 0.62122   1st Qu.:0.03012   1st Qu.:  2.56230   1st Qu.:0.091563   1st Qu.:0.101016   1st Qu.:0.0121283   1st Qu.:  29.82  
 Median : 1.000000   Median : 2.93161   Median :0.14214   Median : 12.09174   Median :0.432093   Median :0.476703   Median :0.0572345   Median : 140.71  
 Mean   : 3.364035   Mean   : 9.86205   Mean   :0.47815   Mean   : 40.67704   Mean   :1.453576   Mean   :1.603644   Mean   :0.1925389   Mean   : 473.37  
 3rd Qu.: 4.279234   3rd Qu.:12.54507   3rd Qu.:0.60823   3rd Qu.: 51.74340   3rd Qu.:1.849027   3rd Qu.:2.039922   3rd Qu.:0.2449199   3rd Qu.: 602.15  
 Max.   :17.471977   Max.   :51.22111   Max.   :2.48339   Max.   :211.26664   Max.   :7.549520   Max.   :8.328936   Max.   :1.0000000   Max.   :2458.56  
      LUF                NLG                PTE          
 Min.   : 0.02083   Min.   :0.001138   Min.   :  0.1035  
 1st Qu.: 0.62122   1st Qu.:0.033937   1st Qu.:  3.0874  
 Median : 2.93161   Median :0.160150   Median : 14.5696  
 Mean   : 9.86205   Mean   :0.538750   Mean   : 49.0126  
 3rd Qu.:12.54507   3rd Qu.:0.685319   3rd Qu.: 62.3467  
 Max.   :51.22111   Max.   :2.798135   Max.   :254.5596  
 > class(euro.cross)
[1] "matrix"
> mode(euro.cross)
[1] "numeric"

3.2 季度收入自变量(4个)

数据维度:39*4
数据名称:freeny.x(R语言)
数据类型:矩阵
部分数据展示:

> head(freeny.x)
     lag quarterly revenue price index income level market potential
[1,]               8.79636     4.70997      5.82110          12.9699
[2,]               8.79236     4.70217      5.82558          12.9733
[3,]               8.79137     4.68944      5.83112          12.9774
[4,]               8.81486     4.68558      5.84046          12.9806
[5,]               8.81301     4.64019      5.85036          12.9831
[6,]               8.90751     4.62553      5.86464          12.9854
> str(freeny.x)
 num [1:39, 1:4] 8.8 8.79 8.79 8.81 8.81 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:4] "lag quarterly revenue" "price index" "income level" "market potential"
  > dim(freeny.x )
[1] 39  4

3.3 50个州的八个指标

数据维度:50*8
数据名称:state.x77(R语言)
数据类型:矩阵
部分数据展示:

> head(state.x77)
           Population Income Illiteracy Life Exp Murder HS Grad Frost   Area
Alabama          3615   3624        2.1    69.05   15.1    41.3    20  50708
Alaska            365   6315        1.5    69.31   11.3    66.7   152 566432
Arizona          2212   4530        1.8    70.55    7.8    58.1    15 113417
Arkansas         2110   3378        1.9    70.66   10.1    39.9    65  51945
California      21198   5114        1.1    71.71   10.3    62.6    20 156361
Colorado         2541   4884        0.7    72.06    6.8    63.9   166 103766
> summary(state.x77)
   Population        Income       Illiteracy       Life Exp         Murder          HS Grad          Frost             Area       
 Min.   :  365   Min.   :3098   Min.   :0.500   Min.   :67.96   Min.   : 1.400   Min.   :37.80   Min.   :  0.00   Min.   :  1049  
 1st Qu.: 1080   1st Qu.:3993   1st Qu.:0.625   1st Qu.:70.12   1st Qu.: 4.350   1st Qu.:48.05   1st Qu.: 66.25   1st Qu.: 36985  
 Median : 2838   Median :4519   Median :0.950   Median :70.67   Median : 6.850   Median :53.25   Median :114.50   Median : 54277  
 Mean   : 4246   Mean   :4436   Mean   :1.170   Mean   :70.88   Mean   : 7.378   Mean   :53.11   Mean   :104.46   Mean   : 70736  
 3rd Qu.: 4968   3rd Qu.:4814   3rd Qu.:1.575   3rd Qu.:71.89   3rd Qu.:10.675   3rd Qu.:59.15   3rd Qu.:139.75   3rd Qu.: 81163  
 Max.   :21198   Max.   :6315   Max.   :2.800   Max.   :73.60   Max.   :15.100   Max.   :67.30   Max.   :188.00   Max.   :566432  
> str(state.x77)
 num [1:50, 1:8] 3615 365 2212 2110 21198 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:50] "Alabama" "Alaska" "Arizona" "Arkansas" ...
  ..$ : chr [1:8] "Population" "Income" "Illiteracy" "Life Exp" ...
> dim(state.x77)
[1] 50  8

3.4 5年不同领域的指标

数据维度:5*5
数据名称:USPersonalExpenditure(R语言)
数据类型:矩阵
部分数据展示:

> USPersonalExpenditure 
                      1940   1945  1950 1955  1960
Food and Tobacco    22.200 44.500 59.60 73.2 86.80
Household Operation 10.500 15.500 29.00 36.5 46.20
Medical and Health   3.530  5.760  9.71 14.0 21.10
Personal Care        1.040  1.980  2.45  3.4  5.40
Private Education    0.341  0.974  1.80  2.6  3.64
> summary(USPersonalExpenditure)
      1940             1945             1950            1955            1960      
 Min.   : 0.341   Min.   : 0.974   Min.   : 1.80   Min.   : 2.60   Min.   : 3.64  
 1st Qu.: 1.040   1st Qu.: 1.980   1st Qu.: 2.45   1st Qu.: 3.40   1st Qu.: 5.40  
 Median : 3.530   Median : 5.760   Median : 9.71   Median :14.00   Median :21.10  
 Mean   : 7.522   Mean   :13.743   Mean   :20.51   Mean   :25.94   Mean   :32.63  
 3rd Qu.:10.500   3rd Qu.:15.500   3rd Qu.:29.00   3rd Qu.:36.50   3rd Qu.:46.20  
 Max.   :22.200   Max.   :44.500   Max.   :59.60   Max.   :73.20   Max.   :86.80  
> str(USPersonalExpenditure)
 num [1:5, 1:5] 22.2 10.5 3.53 1.04 0.341 44.5 15.5 5.76 1.98 0.974 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:5] "Food and Tobacco" "Household Operation" "Medical and Health" "Personal Care" ...
  ..$ : chr [1:5] "1940" "1945" "1950" "1955" ...
> dim(USPersonalExpenditure)
[1] 5 5

3.5 1940年不同年龄个体的死亡数(每千人)

数据维度:5*4
数据名称:VADeaths(R语言)
数据类型:矩阵
部分数据展示:

> head(VADeaths)
      Rural Male Rural Female Urban Male Urban Female
50-54       11.7          8.7       15.4          8.4
55-59       18.1         11.7       24.3         13.6
60-64       26.9         20.3       37.0         19.3
65-69       41.0         30.9       54.6         35.1
70-74       66.0         54.3       71.1         50.0
> summary(VADeaths)
   Rural Male     Rural Female     Urban Male     Urban Female  
 Min.   :11.70   Min.   : 8.70   Min.   :15.40   Min.   : 8.40  
 1st Qu.:18.10   1st Qu.:11.70   1st Qu.:24.30   1st Qu.:13.60  
 Median :26.90   Median :20.30   Median :37.00   Median :19.30  
 Mean   :32.74   Mean   :25.18   Mean   :40.48   Mean   :25.28  
 3rd Qu.:41.00   3rd Qu.:30.90   3rd Qu.:54.60   3rd Qu.:35.10  
 Max.   :66.00   Max.   :54.30   Max.   :71.10   Max.   :50.00  
> str(VADeaths)
 num [1:5, 1:4] 11.7 18.1 26.9 41 66 8.7 11.7 20.3 30.9 54.3 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:5] "50-54" "55-59" "60-64" "65-69" ...
  ..$ : chr [1:4] "Rural Male" "Rural Female" "Urban Male" "Urban Female"
> dim(VADeaths)
[1] 5 4
> class(VADeaths)
[1] "matrix"

3.6 某火山区的地理信息

数据维度:87*61
数据名称:volcano(R语言)
数据类型:矩阵
部分数据展示:

> head(volcano)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [,27] [,28]
[1,]  100  100  101  101  101  101  101  100  100   100   101   101   102   102   102   102   103   104   103   102   101   101   102   103   104   104   105   107
[2,]  101  101  102  102  102  102  102  101  101   101   102   102   103   103   103   103   104   105   104   103   102   102   103   105   106   106   107   109
[3,]  102  102  103  103  103  103  103  102  102   102   103   103   104   104   104   104   105   106   105   104   104   105   106   107   108   110   111   113
[4,]  103  103  104  104  104  104  104  103  103   103   103   104   104   104   105   105   106   107   106   106   106   107   108   110   111   114   117   118
[5,]  104  104  105  105  105  105  105  104  104   103   104   104   105   105   105   106   107   108   108   108   109   110   112   114   115   118   121   122
[6,]  105  105  105  106  106  106  106  105  105   104   104   105   105   106   106   107   109   110   110   112   113   115   116   118   119   121   124   126
     [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [,51] [,52] [,53] [,54] [,55]
[1,]   107   107   108   108   110   110   110   110   110   110   110   110   108   108   108   107   107   108   108   108   108   108   107   107   107   107   106
[2,]   110   110   110   110   111   112   113   114   116   115   114   112   110   110   110   109   108   109   109   109   109   108   108   108   108   107   107
[3,]   114   115   114   115   116   118   119   119   121   121   120   118   116   114   112   111   110   110   110   110   109   109   109   109   108   108   107
[4,]   117   119   120   121   122   124   125   126   127   127   126   124   122   120   117   116   113   111   110   110   110   109   109   109   109   108   108
[5,]   121   123   128   131   129   130   131   131   132   132   131   130   128   126   122   119   115   114   112   110   110   110   110   110   109   109   108
[6,]   126   129   134   137   137   136   136   135   136   136   136   135   133   129   126   122   118   116   115   113   111   110   110   110   110   109   108
     [,56] [,57] [,58] [,59] [,60] [,61]
[1,]   106   105   105   104   104   103
[2,]   106   106   105   105   104   104
[3,]   107   106   106   105   105   104
[4,]   107   107   106   106   105   105
[5,]   107   107   107   106   106   105
[6,]   108   108   107   107   106   106
> str(volcano)
 num [1:87, 1:61] 100 101 102 103 104 105 105 106 107 108 ...
> dim(volcano)
[1] 87 61
> class(volcano)
[1] "matrix"

3.7 7地区在7年中的电话数

数据维度:7*7
数据名称:WorldPhones(R语言)
数据类型:矩阵
部分数据展示:

> head(WorldPhones )
     N.Amer Europe Asia S.Amer Oceania Africa Mid.Amer
1951  45939  21574 2876   1815    1646     89      555
1956  60423  29990 4708   2568    2366   1411      733
1957  64721  32510 5230   2695    2526   1546      773
1958  68484  35218 6662   2845    2691   1663      836
1959  71799  37598 6856   3000    2868   1769      911
1960  76036  40341 8220   3145    3054   1905     1008
> summary(WorldPhones )
     N.Amer          Europe           Asia          S.Amer        Oceania         Africa        Mid.Amer     
 Min.   :45939   Min.   :21574   Min.   :2876   Min.   :1815   Min.   :1646   Min.   :  89   Min.   : 555.0  
 1st Qu.:62572   1st Qu.:31250   1st Qu.:4969   1st Qu.:2632   1st Qu.:2446   1st Qu.:1478   1st Qu.: 753.0  
 Median :68484   Median :35218   Median :6662   Median :2845   Median :2691   Median :1663   Median : 836.0  
 Mean   :66748   Mean   :34343   Mean   :6229   Mean   :2772   Mean   :2625   Mean   :1484   Mean   : 841.7  
 3rd Qu.:73918   3rd Qu.:38970   3rd Qu.:7538   3rd Qu.:3072   3rd Qu.:2961   3rd Qu.:1837   3rd Qu.: 959.5  
 Max.   :79831   Max.   :43173   Max.   :9053   Max.   :3338   Max.   :3224   Max.   :2005   Max.   :1076.0  
> str(WorldPhones )
 num [1:7, 1:7] 45939 60423 64721 68484 71799 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:7] "1951" "1956" "1957" "1958" ...
  ..$ : chr [1:7] "N.Amer" "Europe" "Asia" "S.Amer" ...
> dim(WorldPhones )
[1] 7 7
> class(WorldPhones )
[1] "matrix"

3.8 3000个男性左手中指长度和身高关系

数据维度:42*22
数据名称:crimtab(R语言)
数据类型:矩阵、table
部分数据展示:

> sum(crimtab)
[1] 3000
> crimtab
     142.24 144.78 147.32 149.86 152.4 154.94 157.48 160.02 162.56 165.1 167.64 170.18 172.72 175.26 177.8 180.34 182.88 185.42 187.96 190.5 193.04 195.58
9.4       0      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0
9.5       0      0      0      0     0      1      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0
9.6       0      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0
9.7       0      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0
9.8       0      0      0      0     0      0      1      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0
9.9       0      0      1      0     1      0      1      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0
10        1      0      0      1     2      0      2      0      0     1      0      0      0      0     0      0      0      0      0     0      0      0
10.1      0      0      0      1     3      1      0      1      1     0      0      0      0      0     0      0      0      0      0     0      0      0
10.2      0      0      2      2     2      1      0      2      0     1      0      0      0      0     0      0      0      0      0     0      0      0
10.3      0      1      1      3     2      2      3      5      0     0      0      0      0      0     0      0      0      0      0     0      0      0
10.4      0      0      1      1     2      3      3      4      3     3      0      0      0      0     0      0      0      0      0     0      0      0
10.5      0      0      0      1     3      7      6      4      3     1      3      1      0      1     0      0      0      0      0     0      0      0
10.6      0      0      0      1     4      5      9     14      6     3      1      0      0      1     0      0      0      0      0     0      0      0
10.7      0      0      1      2     4      9     14     16     15     7      3      1      2      0     0      0      0      0      0     0      0      0
10.8      0      0      0      2     5      6     14     27     10     7      1      2      1      0     0      0      0      0      0     0      0      0
10.9      0      0      0      0     2      6     14     24     27    14     10      4      1      0     0      0      0      0      0     0      0      0
11        0      0      0      2     6     12     15     31     37    27     17     10      6      0     0      0      0      0      0     0      0      0
11.1      0      0      0      3     3     12     22     26     24    26     24      7      4      1     0      0      0      0      0     0      0      0
11.2      0      0      0      3     2      7     21     30     38    29     27     20      4      1     0      0      0      0      0     0      0      1
11.3      0      0      0      1     0      5     10     24     26    39     26     24      7      2     0      0      0      0      0     0      0      0
11.4      0      0      0      0     3      4      9     29     56    58     26     22     10     11     0      0      0      0      0     0      0      0
11.5      0      0      0      0     0      5     11     17     33    57     38     34     25     11     2      0      0      0      0     0      0      0
11.6      0      0      0      0     2      1      4     13     37    39     48     38     27     12     2      2      0      1      0     0      0      0
11.7      0      0      0      0     0      2      9     17     30    37     48     45     24      9     9      2      0      0      0     0      0      0
11.8      0      0      0      0     1      0      2     11     15    35     41     34     29     10     5      1      0      0      0     0      0      0
11.9      0      0      0      0     1      1      2     12     10    27     32     35     19     10     9      3      1      0      0     0      0      0
12        0      0      0      0     0      0      1      4      8    19     42     39     22     16     8      2      2      0      0     0      0      0
12.1      0      0      0      0     0      0      0      2      4    13     22     28     15     27    10      4      1      0      0     0      0      0
12.2      0      0      0      0     0      0      1      2      5     6     23     17     16     11     8      1      1      0      0     0      0      0
12.3      0      0      0      0     0      0      0      0      4     8     10     13     20     23     6      5      0      0      0     0      0      0
12.4      0      0      0      0     0      0      1      1      1     2      7     12      4      7     7      1      0      0      1     0      0      0
12.5      0      0      0      0     0      0      0      1      0     1      3     12     11      8     6      8      0      2      0     0      0      0
12.6      0      0      0      0     0      0      0      0      0     1      0      3      5      7     8      6      3      1      1     0      0      0
12.7      0      0      0      0     0      0      0      0      0     1      1      7      5      5     8      2      2      0      0     0      0      0
12.8      0      0      0      0     0      0      0      0      0     0      1      2      3      1     8      5      3      1      1     0      0      0
12.9      0      0      0      0     0      0      0      0      0     0      0      1      2      2     0      1      1      0      0     0      0      0
13        0      0      0      0     0      0      0      0      0     0      3      0      1      0     1      0      2      1      0     0      0      0
13.1      0      0      0      0     0      0      0      0      0     0      0      1      1      0     0      0      0      0      0     0      0      0
13.2      0      0      0      0     0      0      0      0      0     0      1      1      0      1     0      3      0      0      0     0      0      0
13.3      0      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      1      0      1     0      0      0
13.4      0      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0
13.5      0      0      0      0     0      0      0      0      0     0      0      0      0      0     0      0      0      1      0     0      0      0
> str(crimtab)
 'table' int [1:42, 1:22] 0 0 0 0 0 0 1 0 0 0 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:42] "9.4" "9.5" "9.6" "9.7" ...
  ..$ : chr [1:22] "142.24" "144.78" "147.32" "149.86" ...
> dim(crimtab)
[1] 42 22
> class(crimtab)
[1] "table"

3.9 英国男性父子职业联系

数据维度:8*8
数据名称:occupationalStatus(R语言)
数据类型:矩阵、table
部分数据展示:

> occupationalStatus 
      destination
origin   1   2   3   4   5   6   7   8
     1  50  19  26   8   7  11   6   2
     2  16  40  34  18  11  20   8   3
     3  12  35  65  66  35  88  23  21
     4  11  20  58 110  40 183  64  32
     5   2   8  12  23  25  46  28  12
     6  12  28 102 162  90 554 230 177
     7   0   6  19  40  21 158 143  71
     8   0   3  14  32  15 126  91 106
> summary(occupationalStatus)
Number of cases in table: 3498 
Number of factors: 2 
Test for independence of all factors:
        Chisq = 1416, df = 49, p-value = 2.519e-264
        Chi-squared approximation may be incorrect
> str(occupationalStatus)
 'table' int [1:8, 1:8] 50 16 12 11 2 12 0 0 19 40 ...
 - attr(*, "dimnames")=List of 2
  ..$ origin     : chr [1:8] "1" "2" "3" "4" ...
  ..$ destination: chr [1:8] "1" "2" "3" "4" ...
> dim(occupationalStatus)
[1] 8 8
> class(occupationalStatus)
[1] "table"

4、类矩阵

4.1 欧洲12个城市的距离矩阵(下三角)

数据维度:无
数据名称:eurodist(R语言)
数据类型:dist
数据展示:

> eurodist
                Athens Barcelona Brussels Calais Cherbourg Cologne Copenhagen Geneva Gibraltar Hamburg Hook of Holland Lisbon Lyons Madrid Marseilles Milan Munich Paris Rome Stockholm
Barcelona         3313                                                                                                                                                                 
Brussels          2963      1318                                                                                                                                                       
Calais            3175      1326      204                                                                                                                                              
Cherbourg         3339      1294      583    460                                                                                                                                       
Cologne           2762      1498      206    409       785                                                                                                                             
Copenhagen        3276      2218      966   1136      1545     760                                                                                                                     
Geneva            2610       803      677    747       853    1662       1418                                                                                                          
Gibraltar         4485      1172     2256   2224      2047    2436       3196   1975                                                                                                   
Hamburg           2977      2018      597    714      1115     460        460   1118      2897                                                                                         
Hook of Holland   3030      1490      172    330       731     269        269    895      2428     550                                                                                 
Lisbon            4532      1305     2084   2052      1827    2290       2971   1936       676    2671            2280                                                                 
Lyons             2753       645      690    739       789     714       1458    158      1817    1159             863   1178                                                          
Madrid            3949       636     1558   1550      1347    1764       2498   1439       698    2198            1730    668  1281                                                    
Marseilles        2865       521     1011   1059      1101    1035       1778    425      1693    1479            1183   1762   320   1157                                             
Milan             2282      1014      925   1077      1209     911       1537    328      2185    1238            1098   2250   328   1724        618                                  
Munich            2179      1365      747    977      1160     583       1104    591      2565     805             851   2507   724   2010       1109   331                            
Paris             3000      1033      285    280       340     465       1176    513      1971     877             457   1799   471   1273        792   856    821                     
Rome               817      1460     1511   1662      1794    1497       2050    995      2631    1751            1683   2700  1048   2097       1011   586    946  1476               
Stockholm         3927      2868     1616   1786      2196    1403        650   2068      3886     949            1500   3231  2108   3188       2428  2187   1754  1827 2707          
Vienna            1991      1802     1175   1381      1588     937       1455   1019      2974    1155            1205   2937  1157   2409       1363   898    428  1249 1209      2105
> summary(eurodist)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    158     808    1312    1505    2064    4532 
> str(eurodist)
 'dist' num [1:210] 3313 2963 3175 3339 2762 ...
 - attr(*, "Size")= num 21
 - attr(*, "Labels")= chr [1:21] "Athens" "Barcelona" "Brussels" "Calais" ...
> dim(eurodist)
NULL
> class(eurodist)
[1] "dist"

4.2 305个女孩八个形态指标的相关系数矩阵

数据维度:无
数据名称:Harman23.cor(R语言)
数据类型:list
数据展示:

> Harman23.cor
$cov
               height arm.span forearm lower.leg weight bitro.diameter chest.girth chest.width
height          1.000    0.846   0.805     0.859  0.473          0.398       0.301       0.382
arm.span        0.846    1.000   0.881     0.826  0.376          0.326       0.277       0.415
forearm         0.805    0.881   1.000     0.801  0.380          0.319       0.237       0.345
lower.leg       0.859    0.826   0.801     1.000  0.436          0.329       0.327       0.365
weight          0.473    0.376   0.380     0.436  1.000          0.762       0.730       0.629
bitro.diameter  0.398    0.326   0.319     0.329  0.762          1.000       0.583       0.577
chest.girth     0.301    0.277   0.237     0.327  0.730          0.583       1.000       0.539
chest.width     0.382    0.415   0.345     0.365  0.629          0.577       0.539       1.000

$center
[1] 0 0 0 0 0 0 0 0

$n.obs
[1] 305

> summary(Harman23.cor)
       Length Class  Mode   
cov    64     -none- numeric
center  8     -none- numeric
n.obs   1     -none- numeric
> str(Harman23.cor)
List of 3
 $ cov   : num [1:8, 1:8] 1 0.846 0.805 0.859 0.473 0.398 0.301 0.382 0.846 1 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:8] "height" "arm.span" "forearm" "lower.leg" ...
  .. ..$ : chr [1:8] "height" "arm.span" "forearm" "lower.leg" ...
 $ center: num [1:8] 0 0 0 0 0 0 0 0
 $ n.obs : num 305
> dim(Harman23.cor)
NULL
> class(Harman23.cor)
[1] "list"

4.3 145个儿童24个心理指标相关系数矩阵

数据维度:无
数据名称:Harman74.cor(R语言)
数据类型:list
数据展示:

> Harman74.cor
$cov
                       VisualPerception Cubes PaperFormBoard Flags GeneralInformation PargraphComprehension SentenceCompletion WordClassification WordMeaning Addition  Code CountingDots StraightCurvedCapitals WordRecognition
VisualPerception                  1.000 0.318          0.403 0.468              0.321                 0.335              0.304              0.332       0.326    0.116 0.308        0.314                  0.489           0.125
Cubes                             0.318 1.000          0.317 0.230              0.285                 0.234              0.157              0.157       0.195    0.057 0.150        0.145                  0.239           0.103
PaperFormBoard                    0.403 0.317          1.000 0.305              0.247                 0.268              0.223              0.382       0.184   -0.075 0.091        0.140                  0.321           0.177
Flags                             0.468 0.230          0.305 1.000              0.227                 0.327              0.335              0.391       0.325    0.099 0.110        0.160                  0.327           0.066
GeneralInformation                0.321 0.285          0.247 0.227              1.000                 0.622              0.656              0.578       0.723    0.311 0.344        0.215                  0.344           0.280
PargraphComprehension             0.335 0.234          0.268 0.327              0.622                 1.000              0.722              0.527       0.714    0.203 0.353        0.095                  0.309           0.292
SentenceCompletion                0.304 0.157          0.223 0.335              0.656                 0.722              1.000              0.619       0.685    0.246 0.232        0.181                  0.345           0.236
WordClassification                0.332 0.157          0.382 0.391              0.578                 0.527              0.619              1.000       0.532    0.285 0.300        0.271                  0.395           0.252
WordMeaning                       0.326 0.195          0.184 0.325              0.723                 0.714              0.685              0.532       1.000    0.170 0.280        0.113                  0.280           0.260
Addition                          0.116 0.057         -0.075 0.099              0.311                 0.203              0.246              0.285       0.170    1.000 0.484        0.585                  0.408           0.172
Code                              0.308 0.150          0.091 0.110              0.344                 0.353              0.232              0.300       0.280    0.484 1.000        0.428                  0.535           0.350
CountingDots                      0.314 0.145          0.140 0.160              0.215                 0.095              0.181              0.271       0.113    0.585 0.428        1.000                  0.512           0.131
StraightCurvedCapitals            0.489 0.239          0.321 0.327              0.344                 0.309              0.345              0.395       0.280    0.408 0.535        0.512                  1.000           0.195
WordRecognition                   0.125 0.103          0.177 0.066              0.280                 0.292              0.236              0.252       0.260    0.172 0.350        0.131                  0.195           1.000
NumberRecognition                 0.238 0.131          0.065 0.127              0.229                 0.251              0.172              0.175       0.248    0.154 0.240        0.173                  0.139           0.370
FigureRecognition                 0.414 0.272          0.263 0.322              0.187                 0.291              0.180              0.296       0.242    0.124 0.314        0.119                  0.281           0.412
ObjectNumber                      0.176 0.005          0.177 0.187              0.208                 0.273              0.228              0.255       0.274    0.289 0.362        0.278                  0.194           0.341
NumberFigure                      0.368 0.255          0.211 0.251              0.263                 0.167              0.159              0.250       0.208    0.317 0.350        0.349                  0.323           0.201
FigureWord                        0.270 0.112          0.312 0.137              0.190                 0.251              0.226              0.274       0.274    0.190 0.290        0.110                  0.263           0.206
Deduction                         0.365 0.292          0.297 0.339              0.398                 0.435              0.451              0.427       0.446    0.173 0.202        0.246                  0.241           0.302
NumericalPuzzles                  0.369 0.306          0.165 0.349              0.318                 0.263              0.314              0.362       0.266    0.405 0.399        0.355                  0.425           0.183
ProblemReasoning                  0.413 0.232          0.250 0.380              0.441                 0.386              0.396              0.357       0.483    0.160 0.304        0.193                  0.279           0.243
SeriesCompletion                  0.474 0.348          0.383 0.335              0.435                 0.431              0.405              0.501       0.504    0.262 0.251        0.350                  0.382           0.242
ArithmeticProblems                0.282 0.211          0.203 0.248              0.420                 0.433              0.437              0.388       0.424    0.531 0.412        0.414                  0.358           0.304
                       NumberRecognition FigureRecognition ObjectNumber NumberFigure FigureWord Deduction NumericalPuzzles ProblemReasoning SeriesCompletion ArithmeticProblems
VisualPerception                   0.238             0.414        0.176        0.368      0.270     0.365            0.369            0.413            0.474              0.282
Cubes                              0.131             0.272        0.005        0.255      0.112     0.292            0.306            0.232            0.348              0.211
PaperFormBoard                     0.065             0.263        0.177        0.211      0.312     0.297            0.165            0.250            0.383              0.203
Flags                              0.127             0.322        0.187        0.251      0.137     0.339            0.349            0.380            0.335              0.248
GeneralInformation                 0.229             0.187        0.208        0.263      0.190     0.398            0.318            0.441            0.435              0.420
PargraphComprehension              0.251             0.291        0.273        0.167      0.251     0.435            0.263            0.386            0.431              0.433
SentenceCompletion                 0.172             0.180        0.228        0.159      0.226     0.451            0.314            0.396            0.405              0.437
WordClassification                 0.175             0.296        0.255        0.250      0.274     0.427            0.362            0.357            0.501              0.388
WordMeaning                        0.248             0.242        0.274        0.208      0.274     0.446            0.266            0.483            0.504              0.424
Addition                           0.154             0.124        0.289        0.317      0.190     0.173            0.405            0.160            0.262              0.531
Code                               0.240             0.314        0.362        0.350      0.290     0.202            0.399            0.304            0.251              0.412
CountingDots                       0.173             0.119        0.278        0.349      0.110     0.246            0.355            0.193            0.350              0.414
StraightCurvedCapitals             0.139             0.281        0.194        0.323      0.263     0.241            0.425            0.279            0.382              0.358
WordRecognition                    0.370             0.412        0.341        0.201      0.206     0.302            0.183            0.243            0.242              0.304
NumberRecognition                  1.000             0.325        0.345        0.334      0.192     0.272            0.232            0.246            0.256              0.165
FigureRecognition                  0.325             1.000        0.324        0.344      0.258     0.388            0.348            0.283            0.360              0.262
ObjectNumber                       0.345             0.324        1.000        0.448      0.324     0.262            0.173            0.273            0.287              0.326
NumberFigure                       0.334             0.344        0.448        1.000      0.358     0.301            0.357            0.317            0.272              0.405
FigureWord                         0.192             0.258        0.324        0.358      1.000     0.167            0.331            0.342            0.303              0.374
Deduction                          0.272             0.388        0.262        0.301      0.167     1.000            0.413            0.463            0.509              0.366
NumericalPuzzles                   0.232             0.348        0.173        0.357      0.331     0.413            1.000            0.374            0.451              0.448
ProblemReasoning                   0.246             0.283        0.273        0.317      0.342     0.463            0.374            1.000            0.503              0.375
SeriesCompletion                   0.256             0.360        0.287        0.272      0.303     0.509            0.451            0.503            1.000              0.434
ArithmeticProblems                 0.165             0.262        0.326        0.405      0.374     0.366            0.448            0.375            0.434              1.000

$center
 [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

$n.obs
[1] 145

> summary(Harman74.cor)
       Length Class  Mode   
cov    576    -none- numeric
center  24    -none- numeric
n.obs    1    -none- numeric
> str(Harman74.cor)
List of 3
 $ cov   : num [1:24, 1:24] 1 0.318 0.403 0.468 0.321 0.335 0.304 0.332 0.326 0.116 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:24] "VisualPerception" "Cubes" "PaperFormBoard" "Flags" ...
  .. ..$ : chr [1:24] "VisualPerception" "Cubes" "PaperFormBoard" "Flags" ...
 $ center: num [1:24] 0 0 0 0 0 0 0 0 0 0 ...
 $ n.obs : num 145
> dim(Harman74.cor)
NULL
> class(Harman74.cor)
[1] "list"

5、数据框

5.1 空气质量

数据维度:153*6
数据名称:airquality(R语言)
数据类型:数据框
数据展示:

> head(airquality)
  Ozone Solar.R Wind Temp Month Day
1    41     190  7.4   67     5   1
2    36     118  8.0   72     5   2
3    12     149 12.6   74     5   3
4    18     313 11.5   62     5   4
5    NA      NA 14.3   56     5   5
6    28      NA 14.9   66     5   6
> summary(airquality)
     Ozone           Solar.R           Wind             Temp           Month            Day      
 Min.   :  1.00   Min.   :  7.0   Min.   : 1.700   Min.   :56.00   Min.   :5.000   Min.   : 1.0  
 1st Qu.: 18.00   1st Qu.:115.8   1st Qu.: 7.400   1st Qu.:72.00   1st Qu.:6.000   1st Qu.: 8.0  
 Median : 31.50   Median :205.0   Median : 9.700   Median :79.00   Median :7.000   Median :16.0  
 Mean   : 42.13   Mean   :185.9   Mean   : 9.958   Mean   :77.88   Mean   :6.993   Mean   :15.8  
 3rd Qu.: 63.25   3rd Qu.:258.8   3rd Qu.:11.500   3rd Qu.:85.00   3rd Qu.:8.000   3rd Qu.:23.0  
 Max.   :168.00   Max.   :334.0   Max.   :20.700   Max.   :97.00   Max.   :9.000   Max.   :31.0  
 NA's   :37       NA's   :7                                                                      
> str(airquality)
'data.frame':   153 obs. of  6 variables:
 $ Ozone  : int  41 36 12 18 NA 28 23 19 8 NA ...
 $ Solar.R: int  190 118 149 313 NA NA 299 99 19 194 ...
 $ Wind   : num  7.4 8 12.6 11.5 14.3 14.9 8.6 13.8 20.1 8.6 ...
 $ Temp   : int  67 72 74 62 56 66 65 59 61 69 ...
 $ Month  : int  5 5 5 5 5 5 5 5 5 5 ...
 $ Day    : int  1 2 3 4 5 6 7 8 9 10 ...
> dim(airquality)
[1] 153   6
> class(airquality)
[1] "data.frame"

5.2 人工构造的回归数据

数据维度:11*6
数据名称:anscombe (R语言)
数据类型:数据框
注:比较有意思的数据集,使用这四组数据做回归和统计分析你会有意想不到的收获。
数据展示:

> head(anscombe)
  x1 x2 x3 x4   y1   y2    y3   y4
1 10 10 10  8 8.04 9.14  7.46 6.58
2  8  8  8  8 6.95 8.14  6.77 5.76
3 13 13 13  8 7.58 8.74 12.74 7.71
4  9  9  9  8 8.81 8.77  7.11 8.84
5 11 11 11  8 8.33 9.26  7.81 8.47
6 14 14 14  8 9.96 8.10  8.84 7.04
> summary(anscombe)
       x1             x2             x3             x4           y1               y2              y3              y4        
 Min.   : 4.0   Min.   : 4.0   Min.   : 4.0   Min.   : 8   Min.   : 4.260   Min.   :3.100   Min.   : 5.39   Min.   : 5.250  
 1st Qu.: 6.5   1st Qu.: 6.5   1st Qu.: 6.5   1st Qu.: 8   1st Qu.: 6.315   1st Qu.:6.695   1st Qu.: 6.25   1st Qu.: 6.170  
 Median : 9.0   Median : 9.0   Median : 9.0   Median : 8   Median : 7.580   Median :8.140   Median : 7.11   Median : 7.040  
 Mean   : 9.0   Mean   : 9.0   Mean   : 9.0   Mean   : 9   Mean   : 7.501   Mean   :7.501   Mean   : 7.50   Mean   : 7.501  
 3rd Qu.:11.5   3rd Qu.:11.5   3rd Qu.:11.5   3rd Qu.: 8   3rd Qu.: 8.570   3rd Qu.:8.950   3rd Qu.: 7.98   3rd Qu.: 8.190  
 Max.   :14.0   Max.   :14.0   Max.   :14.0   Max.   :19   Max.   :10.840   Max.   :9.260   Max.   :12.74   Max.   :12.500  
> str(anscombe)
'data.frame':   11 obs. of  8 variables:
 $ x1: num  10 8 13 9 11 14 6 4 12 7 ...
 $ x2: num  10 8 13 9 11 14 6 4 12 7 ...
 $ x3: num  10 8 13 9 11 14 6 4 12 7 ...
 $ x4: num  8 8 8 8 8 8 8 19 8 8 ...
 $ y1: num  8.04 6.95 7.58 8.81 8.33 ...
 $ y2: num  9.14 8.14 8.74 8.77 9.26 8.1 6.13 3.1 9.13 7.26 ...
 $ y3: num  7.46 6.77 12.74 7.11 7.81 ...
 $ y4: num  6.58 5.76 7.71 8.84 8.47 7.04 5.25 12.5 5.56 7.91 ...
> dim(anscombe)
[1] 11  8
> class(anscombe)
[1] "data.frame"

5.3 地震的观测数据

数据维度:182*6
数据名称:attenu(R语言)
数据类型:数据框
数据展示:

> head(attenu)
  event mag station dist accel
1     1 7.0     117   12 0.359
2     2 7.4    1083  148 0.014
3     2 7.4    1095   42 0.196
4     2 7.4     283   85 0.135
5     2 7.4     135  107 0.062
6     2 7.4     475  109 0.054
> summary(attenu)
     event            mag           station         dist            accel        
 Min.   : 1.00   Min.   :5.000   117    :  5   Min.   :  0.50   Min.   :0.00300  
 1st Qu.: 9.00   1st Qu.:5.300   1028   :  4   1st Qu.: 11.32   1st Qu.:0.04425  
 Median :18.00   Median :6.100   113    :  4   Median : 23.40   Median :0.11300  
 Mean   :14.74   Mean   :6.084   112    :  3   Mean   : 45.60   Mean   :0.15422  
 3rd Qu.:20.00   3rd Qu.:6.600   135    :  3   3rd Qu.: 47.55   3rd Qu.:0.21925  
 Max.   :23.00   Max.   :7.700   (Other):147   Max.   :370.00   Max.   :0.81000  
                                 NA's   : 16                                     
> str(attenu)
'data.frame':   182 obs. of  5 variables:
 $ event  : num  1 2 2 2 2 2 2 2 2 2 ...
 $ mag    : num  7 7.4 7.4 7.4 7.4 7.4 7.4 7.4 7.4 7.4 ...
 $ station: Factor w/ 117 levels "1008","1011",..: 24 13 15 68 39 74 22 1 8 55 ...
 $ dist   : num  12 148 42 85 107 109 156 224 293 359 ...
 $ accel  : num  0.359 0.014 0.196 0.135 0.062 0.054 0.014 0.018 0.01 0.004 ...
> dim(attenu)
[1] 182   5
> class(attenu)
[1] "data.frame"

5.4 部门的调查结果

数据维度:30*7
数据名称:attitude(R语言)
数据类型:数据框
数据展示:

> head(attitude)
  rating complaints privileges learning raises critical advance
1     43         51         30       39     61       92      45
2     63         64         51       54     63       73      47
3     71         70         68       69     76       86      48
4     61         63         45       47     54       84      35
5     81         78         56       66     71       83      47
6     43         55         49       44     54       49      34
> summary(attitude)
     rating        complaints     privileges       learning         raises         critical        advance     
 Min.   :40.00   Min.   :37.0   Min.   :30.00   Min.   :34.00   Min.   :43.00   Min.   :49.00   Min.   :25.00  
 1st Qu.:58.75   1st Qu.:58.5   1st Qu.:45.00   1st Qu.:47.00   1st Qu.:58.25   1st Qu.:69.25   1st Qu.:35.00  
 Median :65.50   Median :65.0   Median :51.50   Median :56.50   Median :63.50   Median :77.50   Median :41.00  
 Mean   :64.63   Mean   :66.6   Mean   :53.13   Mean   :56.37   Mean   :64.63   Mean   :74.77   Mean   :42.93  
 3rd Qu.:71.75   3rd Qu.:77.0   3rd Qu.:62.50   3rd Qu.:66.75   3rd Qu.:71.00   3rd Qu.:80.00   3rd Qu.:47.75  
 Max.   :85.00   Max.   :90.0   Max.   :83.00   Max.   :75.00   Max.   :88.00   Max.   :92.00   Max.   :72.00  
> str(attitude)
'data.frame':   30 obs. of  7 variables:
 $ rating    : num  43 63 71 61 81 43 58 71 72 67 ...
 $ complaints: num  51 64 70 63 78 55 67 75 82 61 ...
 $ privileges: num  30 51 68 45 56 49 42 50 72 45 ...
 $ learning  : num  39 54 69 47 66 44 56 55 67 47 ...
 $ raises    : num  61 63 76 54 71 54 66 70 71 62 ...
 $ critical  : num  92 73 86 84 83 49 68 66 83 80 ...
 $ advance   : num  45 47 48 35 47 34 35 41 31 41 ...
> dim(attitude)
[1] 30  7
> class(attitude)
[1] "data.frame"

5.5 两只海狸体温数据

数据维度:114x4 + 100x4
数据名称:beaver1 + beaver2(R语言)
数据类型:数据框
注意:beaver1 与 beaver2数据结构一致。
数据展示:

> head(beaver1)
  day time  temp activ
1 346  840 36.33     0
2 346  850 36.34     0
3 346  900 36.35     0
4 346  910 36.42     0
5 346  920 36.55     0
6 346  930 36.69     0
> summary(beaver1)
      day             time             temp           activ        
 Min.   :346.0   Min.   :   0.0   Min.   :36.33   Min.   :0.00000  
 1st Qu.:346.0   1st Qu.: 932.5   1st Qu.:36.76   1st Qu.:0.00000  
 Median :346.0   Median :1415.0   Median :36.87   Median :0.00000  
 Mean   :346.2   Mean   :1312.0   Mean   :36.86   Mean   :0.05263  
 3rd Qu.:346.0   3rd Qu.:1887.5   3rd Qu.:36.96   3rd Qu.:0.00000  
 Max.   :347.0   Max.   :2350.0   Max.   :37.53   Max.   :1.00000  
> str(beaver1)
'data.frame':   114 obs. of  4 variables:
 $ day  : num  346 346 346 346 346 346 346 346 346 346 ...
 $ time : num  840 850 900 910 920 930 940 950 1000 1010 ...
 $ temp : num  36.3 36.3 36.4 36.4 36.5 ...
 $ activ: num  0 0 0 0 0 0 0 0 0 0 ...
> dim(beaver1)
[1] 114   4
> class(beaver1)
[1] "data.frame"

5.6 氧的需求

数据维度:6*2
数据名称:BOD(R语言)
数据类型:数据框
数据展示:

> head(BOD)
  Time demand
1    1    8.3
2    2   10.3
3    3   19.0
4    4   16.0
5    5   15.6
6    7   19.8
> summary(BOD)
      Time           demand     
 Min.   :1.000   Min.   : 8.30  
 1st Qu.:2.250   1st Qu.:11.62  
 Median :3.500   Median :15.80  
 Mean   :3.667   Mean   :14.83  
 3rd Qu.:4.750   3rd Qu.:18.25  
 Max.   :7.000   Max.   :19.80  
> str(BOD)
'data.frame':   6 obs. of  2 variables:
 $ Time  : num  1 2 3 4 5 7
 $ demand: num  8.3 10.3 19 16 15.6 19.8
 - attr(*, "reference")= chr "A1.4, p. 270"
> dim(BOD)
[1] 6 2
> class(BOD)
[1] "data.frame"

5.7 汽车速度对刹车距离数据

数据维度:50*2
数据名称:cars(R语言)
数据类型:数据框
数据展示:

> head(cars)
  speed dist
1     4    2
2     4   10
3     7    4
4     7   22
5     8   16
6     9   10
> summary(cars)
     speed           dist       
 Min.   : 4.0   Min.   :  2.00  
 1st Qu.:12.0   1st Qu.: 26.00  
 Median :15.0   Median : 36.00  
 Mean   :15.4   Mean   : 42.98  
 3rd Qu.:19.0   3rd Qu.: 56.00  
 Max.   :25.0   Max.   :120.00  
> str(cars)
'data.frame':   50 obs. of  2 variables:
 $ speed: num  4 4 7 7 8 9 10 10 10 11 ...
 $ dist : num  2 10 4 22 16 10 18 26 34 17 ...
> dim(cars)
[1] 50  2
> class(cars)
[1] "data.frame"

5.8 小鸡生长速度的影响

数据维度:71*2
数据名称:chickwts(R语言)
数据类型:数据框
数据展示:

> head(chickwts)
  weight      feed
1    179 horsebean
2    160 horsebean
3    136 horsebean
4    227 horsebean
5    217 horsebean
6    168 horsebean
> summary(chickwts)
     weight             feed   
 Min.   :108.0   casein   :12  
 1st Qu.:204.5   horsebean:10  
 Median :258.0   linseed  :12  
 Mean   :261.3   meatmeal :11  
 3rd Qu.:323.5   soybean  :14  
 Max.   :423.0   sunflower:12  
> str(chickwts)
'data.frame':   71 obs. of  2 variables:
 $ weight: num  179 160 136 227 217 168 108 124 143 140 ...
 $ feed  : Factor w/ 6 levels "casein","horsebean",..: 2 2 2 2 2 2 2 2 2 2 ...
> dim(chickwts)
[1] 71  2
> class(chickwts)
[1] "data.frame"

5.9 食管癌病例对照研究数据

数据维度:88*5
数据名称:esoph(R语言)
数据类型:数据框
数据展示:

> head(esoph)
  agegp     alcgp    tobgp ncases ncontrols
1 25-34 0-39g/day 0-9g/day      0        40
2 25-34 0-39g/day    10-19      0        10
3 25-34 0-39g/day    20-29      0         6
4 25-34 0-39g/day      30+      0         5
5 25-34     40-79 0-9g/day      0        27
6 25-34     40-79    10-19      0         7
> summary(esoph)
   agegp          alcgp         tobgp        ncases         ncontrols    
 25-34:15   0-39g/day:23   0-9g/day:24   Min.   : 0.000   Min.   : 1.00  
 35-44:15   40-79    :23   10-19   :24   1st Qu.: 0.000   1st Qu.: 3.00  
 45-54:16   80-119   :21   20-29   :20   Median : 1.000   Median : 6.00  
 55-64:16   120+     :21   30+     :20   Mean   : 2.273   Mean   :11.08  
 65-74:15                                3rd Qu.: 4.000   3rd Qu.:14.00  
 75+  :11                                Max.   :17.000   Max.   :60.00  
> str(esoph)
'data.frame':   88 obs. of  5 variables:
 $ agegp    : Ord.factor w/ 6 levels "25-34"<"35-44"<..: 1 1 1 1 1 1 1 1 1 1 ...
 $ alcgp    : Ord.factor w/ 4 levels "0-39g/day"<"40-79"<..: 1 1 1 1 2 2 2 2 3 3 ...
 $ tobgp    : Ord.factor w/ 4 levels "0-9g/day"<"10-19"<..: 1 2 3 4 1 2 3 4 1 2 ...
 $ ncases   : num  0 0 0 0 0 0 0 0 0 0 ...
 $ ncontrols: num  40 10 6 5 27 7 4 7 2 1 ...
> dim(esoph)
[1] 88  5
> class(esoph)
[1] "data.frame"

6、类数据框

6.1 饮食对鸡生长的影响

数据维度:578*4
数据名称:ChickWeight(R语言)
数据类型:类数据框
数据展示:

> head(ChickWeight)
  weight Time Chick Diet
1     42    0     1    1
2     51    2     1    1
3     59    4     1    1
4     64    6     1    1
5     76    8     1    1
6     93   10     1    1
> summary(ChickWeight)
     weight           Time           Chick     Diet   
 Min.   : 35.0   Min.   : 0.00   13     : 12   1:220  
 1st Qu.: 63.0   1st Qu.: 4.00   9      : 12   2:120  
 Median :103.0   Median :10.00   20     : 12   3:120  
 Mean   :121.8   Mean   :10.72   10     : 12   4:118  
 3rd Qu.:163.8   3rd Qu.:16.00   17     : 12          
 Max.   :373.0   Max.   :21.00   19     : 12          
                                 (Other):506          
> str(ChickWeight)
Classes ‘nfnGroupedData’, ‘nfGroupedData’, ‘groupedData’ and 'data.frame':      578 obs. of  4 variables:
 $ weight: num  42 51 59 64 76 93 106 125 149 171 ...
 $ Time  : num  0 2 4 6 8 10 12 14 16 18 ...
 $ Chick : Ord.factor w/ 50 levels "18"<"16"<"15"<..: 15 15 15 15 15 15 15 15 15 15 ...
 $ Diet  : Factor w/ 4 levels "1","2","3","4": 1 1 1 1 1 1 1 1 1 1 ...
 - attr(*, "formula")=Class 'formula'  language weight ~ Time | Chick
  .. ..- attr(*, ".Environment")=<environment: R_EmptyEnv> 
 - attr(*, "outer")=Class 'formula'  language ~Diet
  .. ..- attr(*, ".Environment")=<environment: R_EmptyEnv> 
 - attr(*, "labels")=List of 2
  ..$ x: chr "Time"
  ..$ y: chr "Body weight"
 - attr(*, "units")=List of 2
  ..$ x: chr "(days)"
  ..$ y: chr "(gm)"
> dim(ChickWeight)
[1] 578   4
> class(ChickWeight)
[1] "nfnGroupedData" "nfGroupedData"  "groupedData"    "data.frame"    

7、列表

7.1 50个州中心的经度和纬度

数据维度:一维
数据名称:state.center(R语言)
数据类型:列表
部分数据展示:

> state.center
$x
 [1]  -86.7509 -127.2500 -111.6250  -92.2992 -119.7730 -105.5130  -72.3573  -74.9841  -81.6850  -83.3736 -126.2500 -113.9300  -89.3776  -86.0808  -93.3714  -98.1156  -84.7674
[18]  -92.2724  -68.9801  -76.6459  -71.5800  -84.6870  -94.6043  -89.8065  -92.5137 -109.3200  -99.5898 -116.8510  -71.3924  -74.2336 -105.9420  -75.1449  -78.4686 -100.0990
[35]  -82.5963  -97.1239 -120.0680  -77.4500  -71.1244  -80.5056  -99.7238  -86.4560  -98.7857 -111.3300  -72.5450  -78.2005 -119.7460  -80.6665  -89.9941 -107.2560
$y
 [1] 32.5901 49.2500 34.2192 34.7336 36.5341 38.6777 41.5928 38.6777 27.8744 32.3329 31.7500 43.5648 40.0495 40.0495 41.9358 38.4204 37.3915 30.6181 45.6226 39.2778 42.3645
[22] 43.1361 46.3943 32.6758 38.3347 46.8230 41.3356 39.1063 43.3934 39.9637 34.4764 43.1361 35.4195 47.2517 40.2210 35.5053 43.9078 40.9069 41.5928 33.6190 44.3365 35.6767
[43] 31.3897 39.1063 44.2508 37.5630 47.4231 38.4204 44.5937 43.0504
> summary(state.center)
  Length Class  Mode   
x 50     -none- numeric
y 50     -none- numeric
> str(state.center)
List of 2
 $ x: num [1:50] -86.8 -127.2 -111.6 -92.3 -119.8 ...
 $ y: num [1:50] 32.6 49.2 34.2 34.7 36.5 ...
> dim(state.center)
NULL
> class(state.center)
[1] "list"

8、时间序列

8.1 一元时间序列

8.1.1 美国年客运里程营收

数据维度:一维
数据名称:airmiles(R语言)
数据类型:时间序列
部分数据展示:

> airmiles    #美国1937-1960年客运里程营收(实际售出机位乘以飞行哩数)
Time Series:
Start = 1937 
End = 1960 
Frequency = 1 
 [1]   412   480   683  1052  1385  1418  1634  2178  3362  5948  6109  5981  6753  8003 10566 12528 14760 16769 19819 22362 25340 25343 29269 30514
 > class(airmiles)
[1] "ts"

8.2 多元时间序列

8.2.1 欧洲股市四个主要指标

数据维度:1860*4
数据名称:EuStockMarkets(R语言)
数据类型:多元时间序列
部分数据展示:

> head(EuStockMarkets)
         DAX    SMI    CAC   FTSE
[1,] 1628.75 1678.1 1772.8 2443.6
[2,] 1613.63 1688.5 1750.5 2460.2
[3,] 1606.51 1678.6 1718.0 2448.2
[4,] 1621.04 1684.1 1708.1 2470.4
[5,] 1618.16 1686.6 1723.1 2484.7
[6,] 1610.61 1671.6 1714.3 2466.8
> summary(EuStockMarkets)
      DAX            SMI            CAC            FTSE     
 Min.   :1402   Min.   :1587   Min.   :1611   Min.   :2281  
 1st Qu.:1744   1st Qu.:2166   1st Qu.:1875   1st Qu.:2843  
 Median :2141   Median :2796   Median :1992   Median :3247  
 Mean   :2531   Mean   :3376   Mean   :2228   Mean   :3566  
 3rd Qu.:2722   3rd Qu.:3812   3rd Qu.:2274   3rd Qu.:3994  
 Max.   :6186   Max.   :8412   Max.   :4388   Max.   :6179  
> dim(EuStockMarkets)
[1] 1860    4
> class(EuStockMarkets)
[1] "mts"    "ts"     "matrix"

9、数组

9.1 3种鸢尾花数据(三维)

数据维度:50x4x3
数据名称:iris3(R语言)
数据类型:数组
部分数据展示:

> iris3
, , Setosa

      Sepal L. Sepal W. Petal L. Petal W.
 [1,]      5.1      3.5      1.4      0.2
 [2,]      4.9      3.0      1.4      0.2
 [3,]      4.7      3.2      1.3      0.2
 [4,]      4.6      3.1      1.5      0.2
 [5,]      5.0      3.6      1.4      0.2
 [6,]      5.4      3.9      1.7      0.4
 [7,]      4.6      3.4      1.4      0.3
 [8,]      5.0      3.4      1.5      0.2
 [9,]      4.4      2.9      1.4      0.2
[10,]      4.9      3.1      1.5      0.1
[11,]      5.4      3.7      1.5      0.2
[12,]      4.8      3.4      1.6      0.2
[13,]      4.8      3.0      1.4      0.1
[14,]      4.3      3.0      1.1      0.1
[15,]      5.8      4.0      1.2      0.2
[16,]      5.7      4.4      1.5      0.4
[17,]      5.4      3.9      1.3      0.4
[18,]      5.1      3.5      1.4      0.3
[19,]      5.7      3.8      1.7      0.3
[20,]      5.1      3.8      1.5      0.3
[21,]      5.4      3.4      1.7      0.2
[22,]      5.1      3.7      1.5      0.4
[23,]      4.6      3.6      1.0      0.2
[24,]      5.1      3.3      1.7      0.5
[25,]      4.8      3.4      1.9      0.2
[26,]      5.0      3.0      1.6      0.2
[27,]      5.0      3.4      1.6      0.4
[28,]      5.2      3.5      1.5      0.2
[29,]      5.2      3.4      1.4      0.2
[30,]      4.7      3.2      1.6      0.2
[31,]      4.8      3.1      1.6      0.2
[32,]      5.4      3.4      1.5      0.4
[33,]      5.2      4.1      1.5      0.1
[34,]      5.5      4.2      1.4      0.2
[35,]      4.9      3.1      1.5      0.2
[36,]      5.0      3.2      1.2      0.2
[37,]      5.5      3.5      1.3      0.2
[38,]      4.9      3.6      1.4      0.1
[39,]      4.4      3.0      1.3      0.2
[40,]      5.1      3.4      1.5      0.2
[41,]      5.0      3.5      1.3      0.3
[42,]      4.5      2.3      1.3      0.3
[43,]      4.4      3.2      1.3      0.2
[44,]      5.0      3.5      1.6      0.6
[45,]      5.1      3.8      1.9      0.4
[46,]      4.8      3.0      1.4      0.3
[47,]      5.1      3.8      1.6      0.2
[48,]      4.6      3.2      1.4      0.2
[49,]      5.3      3.7      1.5      0.2
[50,]      5.0      3.3      1.4      0.2

, , Versicolor

      Sepal L. Sepal W. Petal L. Petal W.
 [1,]      7.0      3.2      4.7      1.4
 [2,]      6.4      3.2      4.5      1.5
 [3,]      6.9      3.1      4.9      1.5
 [4,]      5.5      2.3      4.0      1.3
 [5,]      6.5      2.8      4.6      1.5
 [6,]      5.7      2.8      4.5      1.3
 [7,]      6.3      3.3      4.7      1.6
 [8,]      4.9      2.4      3.3      1.0
 [9,]      6.6      2.9      4.6      1.3
[10,]      5.2      2.7      3.9      1.4
[11,]      5.0      2.0      3.5      1.0
[12,]      5.9      3.0      4.2      1.5
[13,]      6.0      2.2      4.0      1.0
[14,]      6.1      2.9      4.7      1.4
[15,]      5.6      2.9      3.6      1.3
[16,]      6.7      3.1      4.4      1.4
[17,]      5.6      3.0      4.5      1.5
[18,]      5.8      2.7      4.1      1.0
[19,]      6.2      2.2      4.5      1.5
[20,]      5.6      2.5      3.9      1.1
[21,]      5.9      3.2      4.8      1.8
[22,]      6.1      2.8      4.0      1.3
[23,]      6.3      2.5      4.9      1.5
[24,]      6.1      2.8      4.7      1.2
[25,]      6.4      2.9      4.3      1.3
[26,]      6.6      3.0      4.4      1.4
[27,]      6.8      2.8      4.8      1.4
[28,]      6.7      3.0      5.0      1.7
[29,]      6.0      2.9      4.5      1.5
[30,]      5.7      2.6      3.5      1.0
[31,]      5.5      2.4      3.8      1.1
[32,]      5.5      2.4      3.7      1.0
[33,]      5.8      2.7      3.9      1.2
[34,]      6.0      2.7      5.1      1.6
[35,]      5.4      3.0      4.5      1.5
[36,]      6.0      3.4      4.5      1.6
[37,]      6.7      3.1      4.7      1.5
[38,]      6.3      2.3      4.4      1.3
[39,]      5.6      3.0      4.1      1.3
[40,]      5.5      2.5      4.0      1.3
[41,]      5.5      2.6      4.4      1.2
[42,]      6.1      3.0      4.6      1.4
[43,]      5.8      2.6      4.0      1.2
[44,]      5.0      2.3      3.3      1.0
[45,]      5.6      2.7      4.2      1.3
[46,]      5.7      3.0      4.2      1.2
[47,]      5.7      2.9      4.2      1.3
[48,]      6.2      2.9      4.3      1.3
[49,]      5.1      2.5      3.0      1.1
[50,]      5.7      2.8      4.1      1.3

, , Virginica

      Sepal L. Sepal W. Petal L. Petal W.
 [1,]      6.3      3.3      6.0      2.5
 [2,]      5.8      2.7      5.1      1.9
 [3,]      7.1      3.0      5.9      2.1
 [4,]      6.3      2.9      5.6      1.8
 [5,]      6.5      3.0      5.8      2.2
 [6,]      7.6      3.0      6.6      2.1
 [7,]      4.9      2.5      4.5      1.7
 [8,]      7.3      2.9      6.3      1.8
 [9,]      6.7      2.5      5.8      1.8
[10,]      7.2      3.6      6.1      2.5
[11,]      6.5      3.2      5.1      2.0
[12,]      6.4      2.7      5.3      1.9
[13,]      6.8      3.0      5.5      2.1
[14,]      5.7      2.5      5.0      2.0
[15,]      5.8      2.8      5.1      2.4
[16,]      6.4      3.2      5.3      2.3
[17,]      6.5      3.0      5.5      1.8
[18,]      7.7      3.8      6.7      2.2
[19,]      7.7      2.6      6.9      2.3
[20,]      6.0      2.2      5.0      1.5
[21,]      6.9      3.2      5.7      2.3
[22,]      5.6      2.8      4.9      2.0
[23,]      7.7      2.8      6.7      2.0
[24,]      6.3      2.7      4.9      1.8
[25,]      6.7      3.3      5.7      2.1
[26,]      7.2      3.2      6.0      1.8
[27,]      6.2      2.8      4.8      1.8
[28,]      6.1      3.0      4.9      1.8
[29,]      6.4      2.8      5.6      2.1
[30,]      7.2      3.0      5.8      1.6
[31,]      7.4      2.8      6.1      1.9
[32,]      7.9      3.8      6.4      2.0
[33,]      6.4      2.8      5.6      2.2
[34,]      6.3      2.8      5.1      1.5
[35,]      6.1      2.6      5.6      1.4
[36,]      7.7      3.0      6.1      2.3
[37,]      6.3      3.4      5.6      2.4
[38,]      6.4      3.1      5.5      1.8
[39,]      6.0      3.0      4.8      1.8
[40,]      6.9      3.1      5.4      2.1
[41,]      6.7      3.1      5.6      2.4
[42,]      6.9      3.1      5.1      2.3
[43,]      5.8      2.7      5.1      1.9
[44,]      6.8      3.2      5.9      2.3
[45,]      6.7      3.3      5.7      2.5
[46,]      6.7      3.0      5.2      2.3
[47,]      6.3      2.5      5.0      1.9
[48,]      6.5      3.0      5.2      2.0
[49,]      6.2      3.4      5.4      2.3
[50,]      5.9      3.0      5.1      1.8

> summary(iris3)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.100   1.700   3.200   3.465   5.100   7.900 
> str(iris3)
 num [1:50, 1:4, 1:3] 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
 - attr(*, "dimnames")=List of 3
  ..$ : NULL
  ..$ : chr [1:4] "Sepal L." "Sepal W." "Petal L." "Petal W."
  ..$ : chr [1:3] "Setosa" "Versicolor" "Virginica"
> dim(iris3)
[1] 50  4  3
> class(iris3)
[1] "array"

9.2 泰坦尼克信息(四维)

数据维度:4x2x2x2
数据名称:Titanic(R语言)
数据类型:数组、table
部分数据展示:

> Titanic 
, , Age = Child, Survived = No

      Sex
Class  Male Female
  1st     0      0
  2nd     0      0
  3rd    35     17
  Crew    0      0

, , Age = Adult, Survived = No

      Sex
Class  Male Female
  1st   118      4
  2nd   154     13
  3rd   387     89
  Crew  670      3

, , Age = Child, Survived = Yes

      Sex
Class  Male Female
  1st     5      1
  2nd    11     13
  3rd    13     14
  Crew    0      0

, , Age = Adult, Survived = Yes

      Sex
Class  Male Female
  1st    57    140
  2nd    14     80
  3rd    75     76
  Crew  192     20

> summary(Titanic)
Number of cases in table: 2201 
Number of factors: 4 
Test for independence of all factors:
        Chisq = 1637.4, df = 25, p-value = 0
        Chi-squared approximation may be incorrect
> str(Titanic)
 'table' num [1:4, 1:2, 1:2, 1:2] 0 0 35 0 0 0 17 0 118 154 ...
 - attr(*, "dimnames")=List of 4
  ..$ Class   : chr [1:4] "1st" "2nd" "3rd" "Crew"
  ..$ Sex     : chr [1:2] "Male" "Female"
  ..$ Age     : chr [1:2] "Child" "Adult"
  ..$ Survived: chr [1:2] "No" "Yes"
> dim(Titanic)
[1] 4 2 2 2
> class(Titanic)
[1] "table"

9.3 伯克利分校院系、录取、性别的频数(三维)

数据维度:2x2x6
数据名称:UCBAdmissions(R语言)
数据类型:数组、table
部分数据展示:

> UCBAdmissions
, , Dept = A
          Gender
Admit      Male Female
  Admitted  512     89
  Rejected  313     19
, , Dept = B
          Gender
Admit      Male Female
  Admitted  353     17
  Rejected  207      8
, , Dept = C
          Gender
Admit      Male Female
  Admitted  120    202
  Rejected  205    391
, , Dept = D
          Gender
Admit      Male Female
  Admitted  138    131
  Rejected  279    244
, , Dept = E
          Gender
Admit      Male Female
  Admitted   53     94
  Rejected  138    299
, , Dept = F
          Gender
Admit      Male Female
  Admitted   22     24
  Rejected  351    317
> summary(UCBAdmissions)
Number of cases in table: 4526 
Number of factors: 3 
Test for independence of all factors:
        Chisq = 2000.3, df = 16, p-value = 0
> str(UCBAdmissions)
 'table' num [1:2, 1:2, 1:6] 512 313 89 19 353 207 17 8 120 205 ...
 - attr(*, "dimnames")=List of 3
  ..$ Admit : chr [1:2] "Admitted" "Rejected"
  ..$ Gender: chr [1:2] "Male" "Female"
  ..$ Dept  : chr [1:6] "A" "B" "C" "D" ...
> dim(UCBAdmissions)
[1] 2 2 6
> class(UCBAdmissions)
[1] "table"

9.4 592 头色、眼睛颜色和性别的频数(三维)

数据维度:4x4x2
数据名称:HairEyeColor(R语言)
数据类型:数组、table
部分数据展示:

> HairEyeColor
, , Sex = Male

       Eye
Hair    Brown Blue Hazel Green
  Black    32   11    10     3
  Brown    53   50    25    15
  Red      10   10     7     7
  Blond     3   30     5     8

, , Sex = Female

       Eye
Hair    Brown Blue Hazel Green
  Black    36    9     5     2
  Brown    66   34    29    14
  Red      16    7     7     7
  Blond     4   64     5     8

> str(HairEyeColor)
 'table' num [1:4, 1:4, 1:2] 32 53 10 3 11 50 10 30 10 25 ...
 - attr(*, "dimnames")=List of 3
  ..$ Hair: chr [1:4] "Black" "Brown" "Red" "Blond"
  ..$ Eye : chr [1:4] "Brown" "Blue" "Hazel" "Green"
  ..$ Sex : chr [1:2] "Male" "Female"
> dim(HairEyeColor)
[1] 4 4 2
> class(HairEyeColor)
[1] "table"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

统计学小王子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值