1

1 つのリスト (数字、文字、または任意の種類のオブジェクト) を取り、すべての可能な相互作用を表す 2 つのベクトル (またはベクトルのリスト) を返す関数を探しています (table(..)これらの出力に関数を適用する可能性があります)。

> my.fun(list(1,2)) # returns the following
> c(1)
> c(2)

> my.fun(list('a','b','c')) # returns the following
> c('a','a','b')
> c('b','c','c')

> my.fun(list('a','b','c','d')) # returns the following
> c('a','a','a','b','b','c')
> c('b','c','d','c','d','d')

それは理にかなっていますか?

4

1 に答える 1