2022年5月1日

R 条件判断和循环

摘要: 基本语句 判断: if(Condition1){ State1 }else if(Condition2){ State2} else { State_last } 循环 for ( i in xx){ yy} while (xx){yy} 嵌套 for ( i in xx) { if (i yy){ 阅读全文

posted @ 2022-05-01 20:22 BioinformaticsMaster 阅读(96) 评论(0) 推荐(0) 编辑

Rscript 给脚本内传递参数

摘要: 最直接的方式是args<-commandArgs(trailingOnly = TRUE) ,对应args[1],args[2] 如:cat test.R #脚本内容如下 args<-commandArgs(trailingOnly = TRUE)print(args)print (args[1]) 阅读全文

posted @ 2022-05-01 19:42 BioinformaticsMaster 阅读(223) 评论(0) 推荐(0) 编辑

R 自定义函数

摘要: 函数调用 R 所有函数的调用格式为 function(argument1=value1, argument2=value2,...) 如t.test(x=sample,mu=4.5) 对于二元计算 a %x% b 等价于 "x"(a,b) 如 > "+"(2,3) [1] 5 从function( 阅读全文

posted @ 2022-05-01 17:29 BioinformaticsMaster 阅读(349) 评论(0) 推荐(0) 编辑

导航