Public-Health-Scotland / SBSS

Reproducible Analytical Pipeline of the Scottish Bowel Screening Programme Statistics (SBSS) publication
1 stars 0 forks source link

Script 0 #6

Closed gavinc01 closed 5 years ago

gavinc01 commented 5 years ago

As mentioned earlier, pulled a quick script 0 together to declare certain variables in one place, updated scripts 1 and 2 as a result and also put it all in a code folder.

jackhannah95 commented 5 years ago

Yeah you'll need to add a line into the start of scripts 1 and 2 (and then any subsequent scripts that use the things stored in script 0) that's something to the effect of:

source(here::here("code", "0_housekeeping.R"))

Looking good otherwise :thumbsup:

gavinc01 commented 5 years ago

Cheers and apologies both, I've updated 1 and 2 to include source(). I've not used "here" due to the aforementioned server R/desktop R/github faffing but will do when Gitea turns up.

We could probably do with creating a standardised filepath/folder strucure and inlcuding as part of this as well. Another one for the future I think. The future's starting to look pretty busy...

Also, I'm... a little bit... starting to like this whole github thing. I've made a few small tweaks to the code, and hey presto there they are in commit 4. Wonderful.

jackhannah95 commented 5 years ago

You should be able to use here no problem in this context. I understand the issues in using it for loading and saving data files and the difficulties in having to copy + paste code from desktop to server to run, and then back to the desktop to push to GitHub.

However, you'll always want the source line to refer to the script that exists within your current project rather than one on the stats server - having multiple versions of the code saved in multiple locations will get messy pretty quickly.

My advice for sourcing it would be to use the above line that uses here (or something equivalent if you'd prefer) and that should work on the desktop. When it comes to copy + pasting to the server, you'd just have to copy both scripts over, and manually run script 0 at the beginning, rather than running the line that sources it. Bit of a hassle I know, but it means that when the server gets upgraded and/or we get Gitea you won't have to change any code.

Hope that makes sense but happy to give you a call to talk about it if not.

Glad to hear you're one of us now

Alt Text

gavinc01 commented 5 years ago

Cheers Jack, I hadn't been using a project when coding for the server version (I can only apologise for my sins...) which is why it wasn't working but I am now and it is now! Thanks for your persistence, let me know if that does the job.

You know what else I like about github? Previously when making changes to a specific part of code, I always had a - not entirely irrational - fear that I would accidentally change a bit of code that I didn't want to while I was scrolling, thought I had a different window open etc. When I look at github, I know that I haven't done anything by accident, all I've done is change the thing I meant to change. How reassuring.