R语言中给r函数传参
1、
root@DESKTOP-1N42TVH:/home/test2# ls test.r root@DESKTOP-1N42TVH:/home/test2# cat test.r ## 测试函数 argv <- commandArgs(TRUE) ## 参数收集在argv数组中 print(paste0("argv[1]=", argv[1])) print(as.numeric(argv[2])) print(argv[3]) print(argv[7]) root@DESKTOP-1N42TVH:/home/test2# Rscript test.r 10 9 8 7 6 5 4 3 2 1 ## 默认是位置参数 [1] "argv[1]=10" [1] 9 [1] "8" [1] "4"
来源:https://blog.csdn.net/YJJ18636810884/article/details/82890104