R语言 cumsum()用法及代码示例

您所在的位置:网站首页 datacumsum R语言 cumsum()用法及代码示例

R语言 cumsum()用法及代码示例

#R语言 cumsum()用法及代码示例| 来源: 网络整理| 查看: 265

cumsum()R语言中的函数用于计算作为参数传递的向量的累积和。

用法: cumsum(x)

参数:x:数字对象

范例1:

# R program to illustrate  # the use of cumsum() Function    # Calling cumsum() Function cumsum(1:4) cumsum(-1:-6)

输出:

[1] 1 3 6 10 [1] -1 -3 -6 -10 -15 -21

范例2:

# R program to illustrate  # the use of cumsum() Function    # Creating Vectors x1


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3