BiologicalRecordsCentre / BRCindicators

An R package for creating indicators from trends data
4 stars 11 forks source link

Make it easier to extract the BUGS code #19

Closed drnickisaac closed 4 years ago

drnickisaac commented 6 years ago

Steve Freeman and I have been trying to get the BUGS code out of this package and found it very frustratingly difficult. I've added an export statement at the top of bma_BUGS_models.R, but even then we found it difficult. Currently there are two options:

BRCindicators:::bma_model_smooth_det2 which returns an unreadable mess, or

BRCindicators:::bma_model_smooth_det2()

which returns a file string that I have to modify by hand in order to use. This is quite a bad advertisment for collaborative coding. Please write a wrapper function makes this easy to use.

AugustT commented 6 years ago

I never intended the users to be able to read the BUGS code. Perhaps we could simply add a vignette which shows the code? Viewing it in the console is probably never going to be satisfactory.

In the meantime

cat(readLines(BRCindicators:::bma_model_smooth_det2()), sep = '\n')
AugustT commented 4 years ago

I'm yet to be convinced this is something users need. In fact this function no longer exists...

drnickisaac commented 4 years ago

I'm working on this now. My inclination is to disaggregate bma_BUGS_models.R into multiple separate scripts with one function per script. Any reason why this is a bad idea?

drnickisaac commented 4 years ago

Done (locally) with new function get_bmaBUGScode