Irisfee / r3final

dashboard:
https://irisfee.github.io/r3final/
1 stars 3 forks source link

Complete peer review assignment #2

Closed kdestasio closed 3 years ago

kdestasio commented 5 years ago

Strengths:

I changed the code in the following ways:

Areas for improvement:

kdestasio commented 5 years ago

Tagging @datalorax

kdestasio commented 5 years ago

Addressing the conflicts:

(1) Re. knitr::opts_chink$set() "separate in different lines to keep things clear." If you want this on two lines, you still don't need to call the function twice. You can instead do:

knitr::opts_chunk$set(message = FALSE, warning = FALSE, 
                      dpi = 300)

This makes it more visibly accessible to the reader as compared to.

knitr::opts_chunk$set(message = FALSE, warning = FALSE)
knitr::opts_chunk$set(dpi = 300)

(2) Addressing "through the whole scripts we are using path in case someone are going to run the codes over different operation system"

(3) ok

Edit: I've updated the code in the pull request to reflect my comments and to provide a tangible example of how it would work.

Irisfee commented 5 years ago

Hi @kdestasio,

Thanks for reviewing our codes and all the helpful comments!

That's a good point that not to call the opts_chunk twice and just separate the arguments in two lines!

for the here/path choice, it is really impressive that here can actually solve the problem and thanks for showing us the codes! However, I prefer path since it simplifies the arguments I need to put in, and seems to be easier to code (maybe just for me).

all in all, thanks for all your valuable suggestions!

Thanks, Xi & Yufei

kdestasio commented 5 years ago

That makes sense. Whatever is clearest for you is ultimately best :)

datalorax commented 5 years ago

Really nice review, Krista!

With regards to here::here, you actually can (and should) use exactly the same structure with here that you are currently using with path, so I agree with Krista that they are redundant. For example, you currently have

bids_dir <- path(here())         
deriv_dir <- path(bids_dir, "derivatives")
data_dir <- path(deriv_dir, "pattern_similarity")   

but this could be reduced to

here("derivatives", "pattern_similarity")

and the output should be identical.

This means when reading in data, it could simplify to

subj_list <- read_tsv(here("derivatives",  "pattern_similarity",  "participants.tsv"), 
                      col_types = "cicc")

And all the path stuff above that is currently in the code chunk titled dir-setting could go away.

Really good suggestions for improvement too!

Irisfee commented 5 years ago

Hi @datalorax ,

thanks for explaining the usage of here in detail!

However, I prefer to use path to solve the problem within the chunk "read-data", so I want to keep everything in a consistent way.

I prefer to have the dir-setting chunk since the data used in this assignment is just a small part of my actually dataset. It actually needs to read in more files from different folders under a standardized format of fmri dataset and save files in different folders. With the objects of the path to each folder just help me feel clearer to understand the structure of the data. Hope this can be just regarded as my personal coding style.

I do appreciate you all for introducing the function of here to us!

thanks Yufei

datalorax commented 5 years ago

Hi Yufei,

For the assignment, I'm fine with whatever you choose. But I do think that here alone is going to be the more efficient and clearer approach regardless of your data structure, and it is particularly important for exactly the situation you describe, when you have complex data stored across multiple directories. It will also make the code more robust and reproducible. So while you are free to make any choice, I would highly encourage you to think about this critically. I'd be happy to look at your actual project with you and discuss how I would use here within it if you'd like.