Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
for(i in 0:3) { for (j in quantile(0:80,probs=c(0,0.33,0.67,1))) { print(paste(i,j,sep=",")) } }
产生:
"0,0" "0,26.4" "0,53.6" "0,80" "1,0" "1,26.4" . . .
像下面这样生成怎么样:
"0,0" "1,26.4" "2,53.6" "3,80" ?
你真的不需要for循环:
paste(0:3,quantile(0:80,probs=c(0,0.33,0.67,1)),sep=",")
给出:
[1] "0,0" "1,26.4" "2,53.6" "3,80"
如果你想以这种特定方式打印它,你可以循环这个结果并打印。