class: title-slide count: false .title[ # 03 - Projects ] .subtitle[ ## Open Science Tools ] .author[ ### Claudio Zandonella & Davide Massidda ] .institute[ ] --- class: center, middle, inverse # Step II: Project Structure --- # Project Structure -- .code-small[ .pull-left-50[ ``` - Tesi Magistrale/ |- Data Analysis/ |- 10052018.R |- 16052018.R |- Analisi preliminari.docx |- DataAnlysis.R |- Grafici.3D.R |- Limitation.R |- Marginal effects m10.png |- Marginal effects m2.png |- ModelsAnalysis.R |- Parameters m10.png |- Parameters m2.png |- Plots.R |- Posterior Predicto Ext Int.png |- PreparazioneDataset.r |- Prior Probabilities 2.png |- Prior Probabilities.png |- Prior probabilities 3.png |- Sample_analysis.R |- Variables Relative Frequencies.png |- Warm-up Iteractions.png |- claudio.xls |- d.conmeans.rda |- d.correct.rda |- d.finale.rda |- d.girato.rda ``` ] .pull-right-50[ ``` |- d.noNA.rda |- d.selez.rda |- data.CSV |- ext~base.rda |- ext~ssm+ssp.rda |- ext~ssm.bis.rda |- ext~ssm.rda |- ext~ssm_ssp.rda |- ext~ssp.rda |- int1.png |- int2.png |- int~base.rda |- int~ssm+ssp.rda |- int~ssm.rda |- int~ssm_ssp.bis.rda |- int~ssm_ssp.rda |- int~ssp.rda |- int~ssp_ssm.rda |- m1.txt |- naquest0.1.pdf |- naquest01.R |- note_claudio.R |- sample_studies.csv |- studies_table.csv ``` ] ] --- # Project Structure .code-small[ .pull-left-50[ ``` - Tesi Magistrale/ |- Data Analysis/ * |- 10052018.R * |- 16052018.R |- Analisi preliminari.docx |- DataAnlysis.R |- Grafici.3D.R |- Limitation.R |- Marginal effects m10.png |- Marginal effects m2.png |- ModelsAnalysis.R |- Parameters m10.png |- Parameters m2.png |- Plots.R |- Posterior Predicto Ext Int.png |- PreparazioneDataset.r |- Prior Probabilities 2.png |- Prior Probabilities.png |- Prior probabilities 3.png |- Sample_analysis.R |- Variables Relative Frequencies.png |- Warm-up Iteractions.png |- claudio.xls * |- d.conmeans.rda * |- d.correct.rda * |- d.finale.rda * |- d.girato.rda ``` ] .pull-right-50[ ``` * |- d.noNA.rda * |- d.selez.rda |- data.CSV |- ext~base.rda |- ext~ssm+ssp.rda |- ext~ssm.bis.rda |- ext~ssm.rda |- ext~ssm_ssp.rda |- ext~ssp.rda |- int1.png |- int2.png |- int~base.rda |- int~ssm+ssp.rda |- int~ssm.rda * |- int~ssm_ssp.bis.rda * |- int~ssm_ssp.rda |- int~ssp.rda |- int~ssp_ssm.rda |- m1.txt |- naquest0.1.pdf |- naquest01.R |- note_claudio.R |- sample_studies.csv |- studies_table.csv ``` ] ] --- # Project Structure -- .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | * |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Data ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | * |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Data .my-code-block[ ``` - data/ |-- data-raw/ |-- cache/ |-- output/ ``` ] <br> .li-small[ {{content}} ] ] -- - Data in input are **`read-only`** - Share data in **machine readable format** (no `.pdf`) - Add data **documentation** (`data-README`) - Add data **license** --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ * |-- analysis/ |-- documents/ * |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Code <br> .li-small[ {{content}} ] ] -- ### Functional Style {{content}} -- - `analysis/` - Scripts used for running the analysis - `src/` - Scripts with definition of custom functions --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ * |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Documents ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ * |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Documents .my-code-block[ ``` - documents/ |-- paper/ |-- presentation/ |-- report/ ``` ] <br> .li-small[ {{content}} ] ] -- - Use dynamic documents<br>(e.g., Rmarkdown, Jupyter Notebook) - ![](images/03-projects/logo-quarto.png) https://quarto.org/ --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ * |-- README |-- LICENSE ``` ] .pull-right-70[ ## README .li-small[ {{content}} ] ] -- - Title and Authors - Description - Project Structure - Getting Started - Requirements - Installation/Run Analysis - Other - Citation - Acknowledgements --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ * |-- README |-- LICENSE ``` ] .pull-right-70[ ## README .li-small[ - Title and Authors - Description - Project Structure - Getting Started - Requirements - Installation/Run Analysis - Other - Citation - Acknowledgements https://gitlab.inf.unibz.it/URS/builthub/eu27materials ] ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README * |-- LICENSE ``` ] .pull-right-70[ ## LICENSE .center[ {{content}} ] ] -- *Without license all rights are reserved!* --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README * |-- LICENSE ``` ] .pull-right-70[ ## LICENSE .center[ *Without license all rights are reserved!* ] <br> .li-small[ - Software open-source license (e.g., MIT, Apache, GNU GPL)<br>https://choosealicense.com/licenses/ - Materials Creative Commons Licenses <img style="width:7em" src="images/03-projects/cc-by-sa.png" class="inline-img"><br>https://creativecommons.org/about/cclicenses/ - Open data license ] {{content}} ] -- Extra - Aaron Swartz [Story](https://en.wikipedia.org/wiki/Aaron_Swartz) ( [Documentary](https://www.youtube.com/watch?v=M85UvH0TRPc)) --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README * |-- LICENSE ``` ] .pull-right-70[ ## LICENSE .move-up-70[ <img src="images/03-projects/cc-piramid.png" width="40%" style="display: block; margin: auto;" /> ] ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Naming Conventions ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Naming Conventions .li-small[ - Use meaningful names .bad-code[ ```r "untitled.R" # not meaningful name ``` ] .good-code[ ```r "analysis-experiment-A.R" # clear descriptive name ``` ] ] ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Naming Conventions .li-small[ - Use meaningful names - Prefer lower-case names<br>(`my-file.txt` vs `My-File.txt`) ] ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Naming Conventions .li-small[ - Use meaningful names - Prefer lower-case names - Specify files extension ] ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Naming Conventions .li-small[ - Use meaningful names - Prefer lower-case names - Specify files extension - Avoid spaces .bad-code[ ```r "I like to/mess things up.txt" # Your machine is gonna hate you ``` ] .good-code[ ```r "path-to/my-file.txt" ``` ] ] ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Naming Conventions .li-small[ - Use meaningful names - Prefer lower-case names - Specify files extension - Avoid spaces - Avoid special characters .bad-code[ ```r "brûlée-recipe.txt" # surely a good recipe for troubles ``` ] .good-code[ ```r "brulee-reciepe.txt" # use only basic Latin characters ``` ] ] ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Advantages ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Advantages .li-small[ - Ready to share and collaborate - Centralize the analysis ] ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Advantages .li-small[ - Ready to share and collaborate - Centralize the analysis - Configuration files for project settings ] ] --- # Project Structure .pull-left-30[ <br> ```r - my-project/ | |-- data/ |-- analysis/ |-- documents/ |-- src/ |-- README |-- LICENSE ``` ] .pull-right-70[ ## Advantages .li-small[ - Ready to share and collaborate - Centralize the analysis - Configuration files for project settings - **Working directory** and **relative paths** .bad-code[ ```r # absolute path "/Users/<username>/Desktop/my-project/data/my-data.csv" ``` ] .good-code[ ```r # relative path "data/my-data.csv" ``` ] ] ] --- # Extra: The Garden of Forking Paths .pull-left-50[ ### Unix .li-small[ - `"/"` (forward slash) to separate directories .code-compact[ ```r "my-project/data/my-data.csv" ``` ] - `"/"` indicates root-directory .code-compact[ .code-small[ ```r # Mac "/Users/<username>/Desktop/my-project/data/my-data.csv" # Linux "/home/<username>/Desktop/my-project/data/my-data.csv" ``` ]] - `"~"` indicates home-directory <br>`"/Users/<username>/"` - MacOS; `"/home/<username>/"` - Linux .code-compact[ ```r "~/Desktop/my-project/data/my-data.csv" ``` ] ] ] .pull-right-50[ ### Windows Systems .li-small[ - `"\"` (backslash) to separate directories .code-compact[ ```r "my-project\\data\\my-data.csv" ``` ] - `"C:\"` indicates root-directory .code-compact[ ```r "C:\\Users\\<username>\\Desktop\\my-project\\data\\my-data.csv" ``` ] - `"~"` indicates Documents directory ] ### Other Commands .li-small[ - `"."` current working directory - `".."` parent folder ] ] --- class: inverse, middle, center # RStudio Projects --- # RStudio Projects: New Project -- .pull-left-50[ *“File > New Project”* <img src="images/03-projects/new-proj-1.png" width="80%" style="display: block; margin: auto;" /> ] .pull-right-50[ {{content}} ] -- Create project options... <img src="images/03-projects/new-proj-2.png" width="80%" style="display: block; margin: auto;" /> --- # RStudio Projects: New Project .pull-left-50[ Project templates <img src="images/03-projects/new-proj-3.png" width="80%" style="display: block; margin: auto;" /> ] .pull-right-50[ {{content}} ] -- Project specifications <img src="images/03-projects/new-proj-4.png" width="80%" style="display: block; margin: auto;" /> --- # RStudio Projects: Features -- .pull-left-50[ .li-small[ - Working Directory and File Paths <img src="images/03-projects/proj-wd.png" width="80%" style="display: block; margin: auto;" /> {{content}} ] ] .pull-right-50[ ] -- > Always use forward slash `"/"` {{content}} -- - `<project-name>.Rproj` <img src="images/03-projects/rproj-file.png" width="80%" style="display: block; margin: auto;" /> --- # RStudio Projects: Features .pull-left-50[ .li-small[ - Working Directory and File Paths <img src="images/03-projects/proj-wd.png" width="80%" style="display: block; margin: auto;" /> > Always use forward slash `"/"` - `<project-name>.Rproj` <img src="images/03-projects/rproj-file.png" width="80%" style="display: block; margin: auto;" /> ] ] .pull-right-50[ .li-small[ - Project settings <img src="images/03-projects/proj-options.png" width="60%" style="display: block; margin: auto;" /> ] ] --- # RStudio Projects: Features .no-border[ #### Suggested global settings ] -- .pull-left-50[ .li-small[ - Always start in a new empty environment <img src="images/03-projects/general-options.png" width="75%" style="display: block; margin: auto;" /> ] ] .pull-right-50[ .li-small[ {{content}} ] ] -- - *“UTF-8”* encoding <img src="images/03-projects/settings-UTF8.png" width="75%" style="display: block; margin: auto;" /> --- # RStudio Projects: Features .no-border[ #### `.Rprofile` ] .pull-left-50[ <img src="images/03-projects/hidden-files.png" width="75%" style="display: block; margin: auto;" /> {{content}} ] .pull-right-50[ ] -- <img src="images/03-projects/rprofile.png" width="75%" style="display: block; margin: auto;" /> {{content}} -- <img src="images/03-projects/restart-session.png" width="75%" style="display: block; margin: auto;" /> --- # RStudio Projects: Features .no-border[ #### `.Rprofile` ] .pull-left-50[ <img src="images/03-projects/hidden-files.png" width="75%" style="display: block; margin: auto;" /> <img src="images/03-projects/rprofile.png" width="75%" style="display: block; margin: auto;" /> <img src="images/03-projects/restart-session.png" width="75%" style="display: block; margin: auto;" /> ] .pull-right-50[ My `.Rprofile` <img src="images/03-projects/my-rprofile.png" width="75%" style="display: block; margin: auto;" /> ] --- class: inverse, center, middle # Like having multiple office desks! ## Moving to the next step...