本 文 中 使 用 的 数 据 为 iris(鸢 尾 花 ) 。观察数 据 整体的 大小与结构> iris | 花 萼长度 花 萼宽度 花 瓣长度 花 瓣宽度物种 | Sepal.Length Sepal.Width Petal.Length Petal.Width Species1 5.1 3.5 1.4 0.2 setosa2 4.9 3.0 1.4 0.2 setosa3 4.7 3.2 1.3 0.2 setosa4 4.6 3.1 1.5 0.2 setosa5 5.0 3.6 1.4 0.2 setosa6 5.4 3.9 1.7 0.4 setosa7 4.6 3.4 1.4 0.3 setosa8 5.0 3.4 1.5 0.2 setosa9 4.4 2.9 1.4 0.2 setosa10 4.9 3.1 1.5 0.1 setosa………dim()返回数 据 的 维度> dim(iris)|150行,5列|[1] 150 5names()返回数 据 的 名称> names(iris)[1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species"str()返回数 据 的 整体结构> str(iris)'data.frame': 150 obs. of 5 variables: $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ... $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ... $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ..iris为 data.frame类型数 据 ,共150条数 据 ,5个属性。Sepal.Length为 number类型数 据 ,它的 前几条属性值为 ....Sepal.Width为 number类型数 据 ,它的 前几条属性值为 ....Petal.Length为 number类型数 据 ,它的 前几条属性值为 ....Petal.Width为 number类型数 据 ,它的 前几条属性值为 ....Species为 Factor类 型 数 据 , 共 3个 levels:setosa,versicolor,....> attributes(iris)$names[1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species" $row.names [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 [19] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 [37] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 [55] 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 [73] 73 74 75 76...