I suspect that there must be some way, for example gmp's factorialZ seems pre-vectorized:
> library(gmp)
> factorialZ(0:9)
Big Integer ('bigz') object of length 10:
[1] 1 1 2 6 24 120 720 5040 40320 362880
and it appears to be comfortable being used with base R functions that take a vector input and give vector output
> cumsum(factorialZ(0:9))
Big Integer ('bigz') object of length 10:
[1] 1 2 4 10 34 154 874 5914 46234 409114
However, probably because of coercion, attempting to Vectorize a function that outputs bigZ objects will be met with horrible failure:
leftFactorial<-function(n)
{
sum(factorialZ(0:(n-1)))
}
> Vectorize(leftFactorial)(1:10)
[1] 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 01 00 00
[36] 00 01 00 00 00 01 00 00 00 04 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 0a 00 00 00 01 00 00 00 01 00
[71] 00 00 01 00 00 00 22 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 9a 00 00 00 01 00 00 00 01 00 00 00 01
[106] 00 00 00 6a 03 00 00 01 00 00 00 01 00 00 00 01 00 00 00 1a 17 00 00 01 00 00 00 01 00 00 00 01 00 00 00
[141] 9a b4 00 00 01 00 00 00 01 00 00 00 01 00 00 00 1a 3e 06 00
So what should we do when we want to Vectorize a function that outputs bigZ objects?