宫雨 發表於 2022-3-4 10:18:41

R语言数据类型与相应运算的实现

<div id="navCategory"><h5 class="catalogue">目录</h5><ul class="first_class_ul"><li>一、常量与变量</li><ul class="second_class_ul"><li>1.常量 &nbsp;&nbsp;</li><li>2.变量&nbsp; &nbsp; &nbsp;&nbsp;</li></ul><li>二、数据类型</li><ul class="second_class_ul"></ul><li>三、数值型向量</li><ul class="second_class_ul"><li>3.1&nbsp;c() 函数</li><li>3.2&nbsp;length(x)</li><li>3.3&nbsp;numeric()</li></ul><li>四、向量运算</li><ul class="second_class_ul"><li>1.标量和标量运算</li><li>2.向量与标量运算</li><li>3.等长向量运算</li><li>4.不等长向量的运算</li></ul><li>五、向量函数</li><ul class="second_class_ul"><li>1.向量化的函数</li><li>2.排序函数</li><li>3.统计函数</li><li>4.生成规则序列的函数</li></ul><li>六、&nbsp;复数向量</li><ul class="second_class_ul"></ul><li>练习</li><ul class="second_class_ul"></ul></ul></div><p class="maodian"></p><h2>一、常量与变量</h2>
<p class="maodian"></p><h3>1.常量 <strong>&nbsp;&nbsp;</strong></h3>
<p>&nbsp; &nbsp; &nbsp; &nbsp; R 语言基本的数据类型有数值型,逻辑型(TRUE, FALSE),文本(字符串)。 支持缺失值,有专门的复数类型。<br />&nbsp; &nbsp; &nbsp; &nbsp; 常量是指直接写在程序中的值。<br />&nbsp; &nbsp; &nbsp; &nbsp; 数值型常量包括整型、单精度、双精度等,一般不需要区分。写法如 123, 123.45, -123.45,-0.012, 1.23E2, -1.2E-2 等。为了表示 123 是整型,可以写成 123L。<br />&nbsp; &nbsp; &nbsp; &nbsp; 字符型常量用两个双撇号或两个单撇号包围,如&quot;Li Ming&quot; 或&#39;Li Ming&#39;。字符型支持中文,如&quot;李明&quot; 或&#39;李明&#39;。国内的中文编码主要有 GBK 编码和 UTF-8 编码,有时会遇到编码错误造成乱码的题,MS Windows 下 R 程序 一般用 GBK 编码,但是 RStudio 软件采用 UTF-8 编码。在 R 软件内字符串一般用 UTF-8 编码保存。<br />&nbsp; &nbsp; &nbsp; &nbsp; 逻辑型常量只有 TRUE 和 FALSE。<br />&nbsp; &nbsp; &nbsp; &nbsp; 缺失值用 NA 表示。统计计算中经常会遇到缺失值,表示记录丢失、因为错误而不能用、节假日没有数据等。除了数值型,逻辑型和字符型也可以有缺失值,而且字符型的空白值不会自动辨识为缺失值,需要自己规定。R 支持特殊的 Inf 值,这是实数型值,表示正无穷大,不算缺失值。<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;复数常量写法如 2.2 + 3.5i, 1i 等。</p>
<p class="maodian"></p><h3>2.变量&nbsp; &nbsp; &nbsp;&nbsp;</h3>
<p>&nbsp; &nbsp; &nbsp; &nbsp; 程序语言中的变量用来保存输入的值或者计算得到的值。在 R 中,变量可以保存所有的数据类型,比如标量、向量、矩阵、数据框、函数等。<br />&nbsp; &nbsp; &nbsp; &nbsp; 变量都有变量名,R 变量名必须以字母、数字、下划线和句点组成,变量名的第一个字符不能取为数字。在中文环境下,汉字也可以作为变量名的合法字符使用。变量名是区分大小写的,y 和 Y 是两个不同的变量名。<br />&nbsp; &nbsp; &nbsp; &nbsp; 变量名举例: x, x1, X, cancer.tab, clean_data, diseaseData。<br />&nbsp; &nbsp; &nbsp; &nbsp; 用 &lt;-赋值的方法定义变量。&lt;-也可以写成 =,但是 &lt;-更直观。如</p>
<div class="jb51code"><pre class="brush:plain;">x5 &lt;- 6.25
x6 = sqrt(x5)</pre></div>
<p class="maodian"></p><h2>二、数据类型</h2>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R 语言基本的<strong>数据类型</strong>有数值,逻辑型(TRUE, FALSE),文本(字符串)。支持缺失值,有专门的复数类型。 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R 语言<strong>数据结构</strong>包括向量,矩阵和数据框,多维数组,列表,对象等。数据中元素、行、列还可以用名字访问。最基本的是向量类型。向量类型数据的访问方式也是其他数据类型访问方式的基础。</p>
<p class="maodian"></p><h2>三、数值型向量</h2>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>向量</strong>是将若干个基础类型相同的值存储在一起,各个元素可以按序号访问。如 果将若干个数值存储在一起可以用序号访问,就叫做一个数值型向量。</p>
<p class="maodian"></p><h3>3.1&nbsp;c() 函数</h3>
<p>用 <strong>c() </strong>函数把多个元素或向量组合成一个向量。如:</p>
<div class="jb51code"><pre class="brush:py;">marks &lt;- c(10, 6, 4, 7, 8)
marks</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="90" src="https://img.jbzj.com/file_images/article/202203/2022030410121643.png" width="516" /></p>
<p>再如:&nbsp;</p>
<div class="jb51code"><pre class="brush:plain;">x &lt;- c(1:3, 10:13)
x</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="77" src="https://img.jbzj.com/file_images/article/202203/2022030410121644.png" width="593" /></p>
<p>&nbsp;再如:</p>
<div class="jb51code"><pre class="brush:plain;">x1 &lt;- c(1, 2)
x2 &lt;- c(3, 4)
x &lt;- c(x1, x2)
x</pre></div>
<p>返回:</p>
<p><img alt="" height="103" src="https://img.jbzj.com/file_images/article/202203/2022030410121745.png" width="592" /></p>
<p class="maodian"></p><h3>3.2&nbsp;length(x)</h3>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;length(x) </strong>可以求 x 的长度</p>
<div class="jb51code"><pre class="brush:plain;">x &lt;- c(1:3, 10:13)
length(x)</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="69" src="https://img.jbzj.com/file_images/article/202203/2022030410121746.png" width="613" /></p>
<p class="maodian"></p><h3>3.3&nbsp;numeric()</h3>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;numeric() </strong>函数可以用来初始化一个指定元素个数而元素都等于零的数值型向量,如 numeric(10) 会生成元素为 10 个零的向量,长度为零的向量表示为 numeric(0)。</p>
<div class="jb51code"><pre class="brush:plain;">numeric(10)</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="64" src="https://img.jbzj.com/file_images/article/202203/2022030410121747.png" width="691" /></p>
<p class="maodian"></p><h2>四、向量运算</h2>
<p class="maodian"></p><h3>1.标量和标量运算</h3>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单个数值称为<strong>标量</strong>,R 没有单独的标量类型,标量实际是长度为 1 的向量。 R 中四则运算用 + - * / &circ; 表示 (加、减、乘、除、乘方),如</p>
<div class="jb51code"><pre class="brush:plain;">1.5 + 2.3 - 0.6 + 2.1*1.2 - 1.5/0.5 + 2^3
## 10.72</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="51" src="https://img.jbzj.com/file_images/article/202203/2022030410121748.png" width="550" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R 中四则运算仍遵从通常的<strong>优先级规则</strong>,可以用圆括号 () 改变运算的<strong>先后次序</strong>。如</p>
<div class="jb51code"><pre class="brush:plain;">1.5 + 2.3 - (0.6 + 2.1)*1.2 - 1.5/0.5 + 2^3
## 5.56</pre></div>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;除了加、减、乘、除、乘方,R 还支持整除运算和求余运算。用<strong>%/%</strong> 表示<strong>整除</strong>, 用<strong>%%</strong> 表示<strong>求余</strong>。如</p>
<div class="jb51code"><pre class="brush:plain;">5 %/% 3
## 1
5 %% 3
## 2</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="83" src="https://img.jbzj.com/file_images/article/202203/2022030410121749.png" width="586" /></p>
<p class="maodian"></p><h3>2.向量与标量运算</h3>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;向量与标量的运算为<strong>每个元素与标量</strong>的运算, 如</p>
<div class="jb51code"><pre class="brush:plain;">x &lt;- c(1, 10) x + 2
## 3 12
x - 2
## -1 8
x * 2
## 2 20
x / 2
## 0.5 5.0
x ^ 2
## 1 100
2 / x
## 2.0 0.2
2 ^ x
## 2 1024
x %% 2
## 1 0
x %/% 2
## 0 5</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="386" src="https://img.jbzj.com/file_images/article/202203/2022030410121750.png" width="582" /></p>
<p>一个向量乘以一个标量,就是线性代数中的<strong>数乘运算</strong>。 四则运算时如果有<strong>缺失值</strong>,缺失元素参加的运算相应结果元素仍缺失。如</p>
<div class="jb51code"><pre class="brush:plain;">c(1, NA, 3) + 10</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="44" src="https://img.jbzj.com/file_images/article/202203/2022030410121751.png" width="433" /></p>
<p class="maodian"></p><h3>3.等长向量运算</h3>
<p>等长向量的运算为对应元素两两运算。如</p>
<div class="jb51code"><pre class="brush:plain;">x1 &lt;- c(1, 10)
x2 &lt;- c(4, 2)
x1 + x2</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="76" src="https://img.jbzj.com/file_images/article/202203/2022030410121752.png" width="436" /></p>
<p>同样也可以进行减,乘,除;如</p>
<div class="jb51code"><pre class="brush:plain;">x1 - x2
## -3 8
x1 * x2
## 4 20
x1 / x2
## 0.25 5.00</pre></div>
<p class="maodian"></p><h3>4.不等长向量的运算</h3>
<p>&nbsp; &nbsp; &nbsp; &nbsp; 两个不等长向量的四则运算,如果其长度为倍数关系,规则是每次从头重复利用短的一个。如:</p>
<div class="jb51code"><pre class="brush:plain;">x1 &lt;- c(10, 20)
x2 &lt;- c(1, 3, 5, 7)
x1 + x2</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="83" src="https://img.jbzj.com/file_images/article/202203/2022030410121753.png" width="410" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;不仅是四则运算,R 中有两个或多个向量按照元素一一对应参与某种运算或函数调用时,如果<strong>向量长度不同</strong>,一般都采用这样的规则。 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果两个向量的长度<strong>不是倍数</strong>关系,会给出警告信息。如</p>
<div class="jb51code"><pre class="brush:plain;">c(1,2) + c(1,2,3)</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="93" src="https://img.jbzj.com/file_images/article/202203/2022030410121754.png" width="744" /></p>
<p class="maodian"></p><h2>五、向量函数</h2>
<p class="maodian"></p><h3>1.向量化的函数</h3>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R 中的函数一般都是向量化的: 在 R 中,如果普通的一元函数以向量为自变量,一般会对每个元素计算。这样的函数包括 sqrt, log10, log, exp, sin, cos, tan 等许多。如</p>
<div class="jb51code"><pre class="brush:plain;">sqrt(c(1, 4, 6.25))</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="46" src="https://img.jbzj.com/file_images/article/202203/2022030410121755.png" width="587" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;为了<strong>查看这些基础的数学函数</strong>的列表,运行命令 <strong>help.start()</strong>,点击链接 &ldquo;<strong>Search Engine and Keywords</strong>&rdquo;,找到 &ldquo;<strong>Mathematics</strong>&rdquo; 栏目,浏览其中的 &ldquo;<strong>arith</strong>&rdquo; 和 &ldquo;<strong>math</strong>&rdquo; 链接中的说明。</p>
<blockquote><strong>常用的数学函数</strong>有:常用的数学函数有:<br />&bull; 舍入:ceiling, floor, round, signif, trunc, zapsmall<br />&bull; 符号函数 sign<br />&bull; 绝对值 abs<br />&bull; 平方根 sqrt<br />&bull; 对数与指数函数 log, exp, log10, log2<br />&bull; 三角函数 sin, cos, tan<br />&bull; 反三角函数 asin, acos, atan, atan2<br />&bull; 双曲函数 sinh, cosh, tanh<br />&bull; 反双曲函数 asinh, acosh, atanh</blockquote>
<blockquote><strong>有一些不太常用的数学函数</strong>:<br />&bull; 贝塔函数 beta, lbeta<br />&bull; 伽 玛 函 数 gamma, lgamma, digamma, trigamma, tetragamma, pentagamma<br />&bull; 组合数 choose, lchoose<br />&bull; 富利叶变换和卷积 fft, mvfft, convolve<br />&bull; 正交多项式 poly<br />&bull; 求根 polyroot, uniroot<br />&bull; 最优化 optimize, optim<br />&bull; Bessel 函数 besselI, besselK, besselJ, besselY<br />&bull; 样条插值 spline, splinefun<br />&bull; 简单的微分 deriv</blockquote>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果自己编写的函数<strong>没有考虑向量化</strong>问题,可以用 <strong>Vectorize() </strong>函数将其转换成向量化版本。</p>
<p class="maodian"></p><h3>2.排序函数</h3>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>sort(x)</strong> 返回排序结果。<strong>rev(x) </strong>返回把各元素排列次序反转后的结果。<strong>order(x) </strong>返回排序用的下标。如</p>
<div class="jb51code"><pre class="brush:plain;">x &lt;- c(33, 55, 11)
sort(x)
## 11 33 55
rev(sort(x))
## 55 33 11
order(x)
## 3 1 2
x
## 11 33 55</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="222" src="https://img.jbzj.com/file_images/article/202203/2022030410121856.png" width="569" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>order(x)&nbsp;</strong>&nbsp;结果中 3 是 x 的最小元素 11 所在的位置下标,1 是 x 的 第二小元素 33 所在的位置下标,2 是 x 的最大元素 55 所在的位置下标。</p>
<p class="maodian"></p><h3>3.统计函数</h3>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>sum(求和)</strong>, <strong>mean(求平均值)</strong>, <strong>var(求样本方差)</strong>, <strong>sd(求样本标准差)</strong>, <strong>min(求最小值)</strong>, <strong>max(求最大值)</strong>, r<strong>ange(求最小值和最大值) </strong>等函数称为<strong>统计函数</strong>,把输入向量看作样本,计算样本统计量。<strong>prod</strong> 求所有元素的乘积。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>cumsum</strong> 和 <strong>cumprod</strong> 计算<strong>累加和累乘积</strong>。如</p>
<div class="jb51code"><pre class="brush:plain;">cumsum(1:5)</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="45" src="https://img.jbzj.com/file_images/article/202203/2022030410121857.png" width="524" /></p>
<div class="jb51code"><pre class="brush:plain;">cumprod(1:5)</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="42" src="https://img.jbzj.com/file_images/article/202203/2022030410121858.png" width="489" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;其它一些类似函数有 <strong>pmax</strong>, <strong>pmin</strong>, <strong>cummax</strong>, <strong>cummin</strong> 等。</p>
<p class="maodian"></p><h3>4.生成规则序列的函数</h3>
<p>seq 函数是冒号运算符的推广。比如</p>
<div class="jb51code"><pre class="brush:py;">seq(5)
seq(2,5)
seq(11, 15, by=2)
#产生从 0 到 2π 的等间隔序列,序列长度指定为 100
seq(0, 2*pi, length.out=100) </pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="478" src="https://img.jbzj.com/file_images/article/202203/2022030410121859.png" width="784" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在使用<strong>变量名时次序</strong>可以颠倒,比如</p>
<div class="jb51code"><pre class="brush:plain;">seq(to=5, from=2)</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="45" src="https://img.jbzj.com/file_images/article/202203/2022030410121860.png" width="560" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>rep()</strong> 函数用来产生重复数值。</p>
<p>为了产生一个初值为零的长度为 n 的向量,用 x &lt;- rep(0, n) 。</p>
<div class="jb51code"><pre class="brush:plain;">rep(c(1,3), 2)</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="47" src="https://img.jbzj.com/file_images/article/202203/2022030410121861.png" width="477" /></p>
<p>&nbsp;再比如:</p>
<div class="jb51code"><pre class="brush:plain;">rep(c(1,3), c(2,4))</pre></div>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;把第一自变量的第一个元素 1 按照第二自变量中第一个元素 2 的次数重复,把第一自变量 中第二个元素 3 按照第二自变量中第二个元素 4 的次数重复,返回:</p>
<p style="text-align:center"><img alt="" height="44" src="https://img.jbzj.com/file_images/article/202203/2022030410121862.png" width="543" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如 果 希 望 重 复 完 一 个 元 素 后 再 重 复 另 一 元 素, 用 <strong>each= </strong>选 项, 比 如</p>
<div class="jb51code"><pre class="brush:plain;">rep(c(1,3), each=2)</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="48" src="https://img.jbzj.com/file_images/article/202203/2022030410121863.png" width="499" /></p>
<p class="maodian"></p><h2>六、&nbsp;复数向量</h2>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>复数常数</strong>表示如 3.5+2.4i, 1i。用函数 <strong>complex() </strong>生成复数向量,指定实部和虚部。如</p>
<div class="jb51code"><pre class="brush:plain;">complex(c(1,0,-1,0), c(0,1,0,-1))</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="45" src="https://img.jbzj.com/file_images/article/202203/2022030410121964.png" width="533" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在 <strong>complex()</strong> 中可以用 <strong>mod</strong> 和 <strong>arg</strong> 指定模和辐角,如</p>
<div class="jb51code"><pre class="brush:plain;">complex(mod=1,arg=(0:3)/2*pi)</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="46" src="https://img.jbzj.com/file_images/article/202203/2022030410121965.png" width="447" /></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;用 <strong>Re(z)</strong> 求 z 的实部,用 <strong>Im(z)</strong> 求 z 的虚部,用 <strong>Mod(z)</strong> 或 <strong>abs(z)</strong> 求 z 的模,用 <strong>Arg(z)</strong> 求 z 的辐角,用 <strong>Conj(z)</strong> 求 z 的共轭。 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>sqrt</strong>, <strong>log</strong>, <strong>exp</strong>, <strong>sin</strong> 等函数对复数也有定义,但是函数定义域在自变量为实数时可能有限制而复数无限制,这时需要<strong>区分自变量类型</strong>。如</p>
<div class="jb51code"><pre class="brush:plain;">sqrt(-1)sqrt(-1 + 0i)</pre></div>
<p>返回:</p>
<p style="text-align:center"><img alt="" height="121" src="https://img.jbzj.com/file_images/article/202203/2022030410121966.png" width="686" /></p>
<p class="maodian"></p><h2>练习</h2>
<p>1. 显示 1 到 100 的整数的平方根和立方根(提示:立方根就是三分之一次 方)。&nbsp;<br />2. 设有 10 个人的小测验成绩为:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;77 60 91 73 85 82 35 100 66 75<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1) 把这 10 个成绩存入变量 x;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(2) 从小到大排序;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(3) 计算 order(x),解释 order(x) 结果中第 3 项代表的意义。<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(4) 计算这些成绩的平均值、标准差、最小值、最大值、中位数。<br />3. 生成 区间上等间隔的 100 个格子点存入变量 x 中。</p>
<p>到此这篇关于R语言数据类型与相应运算的实现的文章就介绍到这了,更多相关R语言数据类型与相应运算内容请搜索琼殿技术社区以前的文章或继续浏览下面的相关文章希望大家以后多多支持琼殿技术社区!</p>
                           
                            <div class="art_xg">
                              <b>您可能感兴趣的文章:</b><ul><li>R语言数据类型知识点总结</li><li>R语言数据类型和对象深入讲解</li><li>R语言数据类型深入详解</li><li>R语言基础数据类型的具体使用</li></ul>
                            </div>

                        </div>
                        <!--endmain-->
頁: [1]
查看完整版本: R语言数据类型与相应运算的实现