SORTEE / peer-code-review

https://sortee.github.io/peer-code-review/
4 stars 4 forks source link

CodeReviewRequest: November 3 2021 meeting #7

Closed roseodea closed 2 years ago

roseodea commented 2 years ago

Author: roseodea

Repo: https://osf.io/v3qax/

Aim: The repository contains the code, data, models etc corresponding to this recently accepted manuscript. As the manuscript is intended as a practical guide for students to be able to run these models themselves, it's important that the repository is as user-friendly as possible. So, are there aspects of the repository that could be improved, or is there anything that doesn't work if you try to run it yourself? More specifically, for the meeting in November 3, I thought it could be interesting to look at the file for producing the conceptual figures and see if there's a better way to do it. The process of producing Figure 3 is rather cumbersome (link to the file below).

File Info: Files are described in https://osf.io/v3qax/wiki/home/. For the meeting, there is a particular bit of code in the file for generating figure 3 that doesn't work very well. It's the section Fig. 3F Plasticity-Predictability Association: to make the figure I re-run this section until the plot looks okay, but a lot of the time the density plots on the margins of the figure get cut-off when they're generated.

roseodea commented 2 years ago

Cool things we learnt:

How does set seed work? https://stackoverflow.com/questions/20624698/fixing-set-seed-for-an-entire-session

set.seed(1)
rnorm(1, 0, 1)
rnorm(1, 0, 1)
rnorm(1, 0, 1)
addTaskCallback(function(...) {set.seed(336);TRUE})

Solution to the Figure 3 F problem: needed to extend the limits of the x-axis, as the density curves were getting cut off sometimes

This is an issue if people haven't set up the folder structure:

ggsave(filename = "./Figures/Figure 3.pdf",
       plot = Fig3,
       height = 10, width = 9,
       device = cairo_pdf)

Get a mysterious error about Cairo, but it's because you don't have the figure folder

So, need to think about how people interact with your code. Maybe could set up at the top arguments for file structures.

Font issue: if people haven't got extrafont::font_import() set up, might have trouble with a non-conventional font choice. Should make it easy to change font choice by having fontchoice as an object up the top (rather than having to find and replace everything)

Also handy tip: pacman::p_load() will load your packages and install them if they're not already installed