gadget-framework / rgadget

Rgadget is a set of useful utilities for gadget
6 stars 12 forks source link

customise printfiles gadget_project_output #112

Closed vbartolino closed 3 years ago

vbartolino commented 3 years ago

when I run gadget_project_output the printfiles generated are automatically set with the argument precision 1 which seems too coarse in my case. The function can be easily hacked, but I was wondering if there is possibility to specify the precision and other arguments for those printfiles more elegantly

bthe commented 3 years ago

Indeed there is, the gadget_project_* functions alway return a gadget directory object and you can build your own output function with a combination of gadgetprint and gadget_update:

custom_print <- function(gd, other, variable, if, necessary){

gadgetprint('custom_printfilename', gd, missingokay = TRUE) %>%
gadget_update(....) %>%
... %>%
write.gadget.file(gd)

return(gd)

}

and replace gadget_project_output with your custom function.

vbartolino commented 3 years ago

I was sure :) thanks