RobinHankin / frab

1 stars 0 forks source link

rfrabbb() infelicity #24

Closed RobinHankin closed 4 months ago

RobinHankin commented 6 months ago

rfrabbb(n=10,i=5) takes a very long time to run. This is because of the expand.grid() constuction. Something like

replicate(5,paste(sample(letters,5,replace=TRUE),collapse=""))
# [1] "jydlp" "kumyb" "xwxmn" "tqvsd" "twiwk"

might be better.

RobinHankin commented 6 months ago
f <- function(n=5000, v=-10:10,symb=letters,i=3){
frab(setNames(sample(v,n,replace=TRUE),replicate(n,paste(sample(symb,i,replace=TRUE),collapse=""))))
}