R语言批量运行

1. R循环操作

  • for函数
  • map函数
  • apply函数
  1. for 循环结构
#for循环结构
for (variable in vector) {
    
    
 action(variable)
}

for循环单个例子:

#for循环执行
#第一个例子_批量输出某个数值
for (i in seq(1,10,2)) {
    
    
 print(i)
}
#[1] 1
#[1] 3
#[1] 5
#[1] 7
#[1] 9

for循环实战例子:

参考链接:https://mp.weixin.qq.com/s/9yJ3CTHp57_loIRXgRU0DA

猜你喜欢

转载自blog.csdn.net/weixin_44231554/article/details/131727615