ThinkR-open / golem

A Framework for Building Robust Shiny Apps
https://thinkr-open.github.io/golem/
Other
915 stars 133 forks source link

Subfolder in R-folder #631

Closed ZimmermannYves closed 3 years ago

ZimmermannYves commented 3 years ago

Hello,

I am very much enjoying the golem package. After some small project I'm now building a lager one. For this bigger project I would like to neatly organize my R-scripts in subfolders of the main R-folder. For example like this:

R/modules R/functions R/plots ...

Sadly this is not working. You also write in your book "Engineering Production-Grade Shiny Apps" in the chapter 4.2.2 R/": "Note also that this folder can’t contain sub-folders."

Is it no possible to introduce subfolders or is there another way to achieve the same result?

Best regards

Yves

VincentGuyader commented 3 years ago

Hi,

Unfortunately, this is not possible. A golem is "just" an R package, and as long as this is not possible in an R package, it will not be possible inside golem.

(as I write this I can think of a few ways to implement this, but it will deviate from the traditional way of working)

VincentGuyader commented 3 years ago

@ColinFay we can use collate in DESCRIPTION to link to subfolder... see :https://stackoverflow.com/a/33779157/1020027

ZimmermannYves commented 3 years ago

Thank you for your fast reply, Vincent!

I read the https://stackoverflow.com/a/33779157/1020027 and some other stackoverflow articles. It seems that "collate:" does not work anymore.

For now, I will try to implement good names to better organize my scripts.

plot_aaa.R plot_bbb.R ...

ColinFay commented 3 years ago

Hey @ZimmermannYves,

As @VincentGuyader said, this is a limitation linked to the R package structure and there is unfortunately no reliable way to implement this :(

Here are some recommendation for code organization :

Colin

ColinFay commented 3 years ago

Hey,

Given that it is a limitation of R itself (not of {golem} per se), I think this one should be closed for now.

@ZimmermannYves feel free to comment again if you have any other question or ideas :)

Thanks, Colin