函数功能

rep replicates the values in x.

复制x中的值

函数语法:

rep(x, times = 1, length.out = NA, each = 1)

函数参数:

x
a vector (of any mode including a list) or a factor
or (for rep only) a POSIXct or POSIXlt or Date object;
or an S4 object containing such an object.

x: 重复的对象

times
an integer-valued vector giving the (non-negative) number of times
to repeat each element if of length length(x),
or to repeat the whole vector if of length 1.
Negative or NA values are an error.
A double vector is accepted,
other inputs being coerced to an integer or double vector.

times: 重复次数

If ‘times’consists of a single integer,
the result consists of the whole input repeated this many times.
If ‘times’ is a vector of the same length as ‘x’ (after replication by each),
the result consists of x[1] repeated times[1] times,
x[2] repeated times[2] times and so on.

当参数times为单个整数,则将整个输入重复times次。若times是与复制对象x(each参数执行之后)长度相同的向量,则向量x中的每个元素对应重复times中对应位置数据的次数。

length.out
non-negative integer.
The desired length of the output vector.
Other inputs will be coerced to a double vector and the first element taken.
Ignored if NA or invalid.

输出长度:非负数整数。当times或each与length.out同时指定时,必须满足length.out。

‘length.out’ may be given in place of ‘times’,
in which case x is repeated as many times as is necessary to create a vector of this length.
If both are given, length.out takes priority and times is ignored.

当创建某个长度的向量时,length.out会代替times参数出现。如果参数times与length.out同时给定,则length.out的设定优先满足。

each
non-negative integer.
Each element of x is repeated each times.
Other inputs will be coerced to an integer or double vector
and the first element taken. Treated as 1 if NA or invalid.

每个元素重复次数:非负整数型。

Normally just one of the additional arguments is specified,
but if ‘each ’is specified with either of the other two,
its replication is performed first,
and then that implied by times or length.out.

通常只指定一个参数,但是如果each参数与某个参数一起指定,复制会首先执行,但需要满足times参数或length.out。

rep( )函数--R语言相关推荐

  1. c r语言中rank函数,R语言rank函数详细解析

    R语言rank函数详细解析 发布于 2016-01-04 16:26:04 | 557 次阅读 | 评论: 0 | 来源: PHPERZ R 数据统计分析语言R是用于统计分析.绘图的语言和操作环境.R ...

  2. quantile函数r语言_R中的Quantile()函数-简要指南

    quantile函数r语言 You can generate the sample quantiles using the quantile() function in R. 您可以使用R中的Quan ...

  3. r 语言c函数,R语言常用函数详解

    R语言对于我们生信人员来讲,再熟悉不过,然而任何一门语言想要学好,必须经过常年的日积月累才可以做到,在这里,我列举R中常用的函数的用法, 供大家学习. 1.序列函数seq 用法: seq(form,t ...

  4. matlab 雷达图函数,R语言之可视化(20)ggradar雷达图

    目录 R语言之可视化(20)ggradar雷达图 ======================= ggradar是一个ggplot2函数,主要用于绘制数据分析的雷达图. 它基于Ricardo Bion ...

  5. c语言分组求和函数,R语言 实现data.frame 分组计数、求和等

    df为1个data.frame对象,有stratum和psu两列,这里统计stratum列计数 方法1: cnt = table(df$stratum) 方法2: cnt = tapply(df$ps ...

  6. 1071svm函数 r语言_R语言机器学习之核心包e1071 - 数据分析

    R语言有很多包可以做机器学习(Machine Learning)的任务.机器学习的任务主要有有监督的学习方式和无监督的学习方式. 有监督学习:在正确结果指导下的学习方式,若是正确结果是定性的,属于分类 ...

  7. 自定义函数 | R语言偏相关分析及绘图

    R语言的偏相关分析过程 偏相关分析介绍 阶偏相关分析: 偏相关系数: Pearson相关系数 Spearman相关系数 Kendall等级相关系数 R语言实现偏相关分析 pcor() pcor.tes ...

  8. c 语言matrix函数,R语言矩阵matrix函数

    矩阵是元素布置成二维矩形布局的R对象. 它们包含相同原子类型的元素.尽管我们可以创建只包含字符或只逻辑值的矩阵,但是它们没有多大用处.我们使用的是在数学计算中含有数字元素矩阵. 使用 matrix() ...

  9. c语言apply函数,R语言apply()函数用法(示例代码)

    在R语言的帮助文档里,apply函数的功能是: Retruns a vector or array or list of values obtained by applying a function ...

  10. r语言 c d生产函数,R语言 函数与模型(12):随机前沿模型SFA

    ______________________________ ______________________________ 查看往期R语言与函数系列 _________________________ ...

最新文章

  1. Css Font 详细研究
  2. Formal Languages and Compilers-LL(1),FIRST and FOLLOW
  3. 《系统集成项目管理工程师》必背100个知识点-18项目管理计划的ITTO
  4. dmp标签_京东dmp人群标签的使用,直接决定了你快车的盈利
  5. C#获取文件夹下的所有文件的文件名
  6. ASP.NET 安全认证(四)
  7. 实现三联tab切换特效
  8. python全栈索引
  9. Java基础学习总结(86)——Java异常处理机制Exception抛出异常时throw和throws用法详解
  10. 波士顿动力又有新视频:机器狗要开门,人类真是拽不回来
  11. FxFactory 7.1.1 完整破解版:258个视觉特效插件 FCPX\AE\PR MAC苹果系统
  12. php 和 java 美刀,通过GOOGLE(谷歌) API获取实时货币汇率(人民币和美金)的PHP代码
  13. sql注入检测工具 mysql_Java自动化SQL注入测试工具—jSQL Injection v0.5
  14. 非负矩阵分解NMF简介
  15. OpenCV获取轮廓最大内接正矩形(C++源码)
  16. Skipping JaCoCo execution due to missing execution data file
  17. VS如何导入已有项目文件夹
  18. QQ红包金额分配算法
  19. python特殊符号_Python一行代码过滤标点符号等特殊字符
  20. 利用Python提取函数图像数据并拟合曲线

热门文章

  1. 深度学习CNN, R-CNN
  2. Atitit 变量类型系统 目录 1. 通用类型系统 (Common Type System) 1 1.1. CTS 的类型[编辑] 1 2. CLR支持两种基本类型:值类型和引用类型。因此,还是把
  3. Atitit 分布式文件系统总结 fastdfs nfs smb webdav ftp 目录 1.1. webdav 是个好的方案。。。Server client都有 1 1.2. ftp也方便ja
  4. Atitit orm 之道 艾龙著 1. 一、ORM的由来 1 2. ORM的组成:      2 3.  常见的ORM框架:      3 4. 、ORM与数据持久化的关系 3 5. Atitit
  5. 高频交易鼻祖竟是靠「金发女郎」取得了400%的年回报
  6. 实话实说?基金公司“存量时代”的创新
  7. 我们眼中的资管管理行业三要素
  8. Rust: map中的问题,两种写法有什么不同?
  9. oracle左连接没用_Oracle左连接,右连接
  10. 【车间调度】基于matlab差分进化算法求解作业车间调度问题【含Matlab源码 1743期】