Is there an idiom for doing repeated calls to resample_permutation
? I tried, on an already nested frame,
df %>%
mutate(perms = map(.$dfcolumn, ~replicate(1000, resample_permutation(., c('perm_column'))) %>%
unnest(perms, .drop=F)
This seems to do the permutations, but then it is in the wrong form for unnesting. I noodled around a bit with enframe
and transposing, but I haven't found an elegant solution yet.
I want to:
- Use
nest()
to create a nested data frame - Repeatedly shuffle/permute one column of the nested frame
- Model fit all the shuffled copies
- Summarize