如何使用四个参数的所有可能组合执行函数? [R]

时间:2019-06-25 17:23:04

标签: parameter-passing

我有一个函数pred(a, b, c, alpha),它带有四个参数。每个参数都有一些可能的值,我想对四个参数的所有可能组合进行迭代。

b = {4,5,6}
c= {8, 9, 10}
alpha = {0.1, .3, .4}```  

For example, ```pred(a = 1, b = 4, c = 8, alpha = 0.1```, ```pred(a = 2, b = 4, c = 8, alpha = 0.1```, ```pred(a = 3, b = 4, c = 8, alpha = 0.1```, etc. 

Instead of writing a four-step loop, how can I do this more efficiently in R?

0 个答案:

没有答案