From d53264e8c167315d4f96771332765f18f6ce4b94 Mon Sep 17 00:00:00 2001 From: Nami Sunami Date: Sun, 26 Jan 2025 15:26:20 +0100 Subject: [PATCH 1/9] feat(Dockerfile): Use rocker/tidyverse:4.4.2 image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index aea3acb..d4a5f6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rocker/rstudio:4 +FROM rocker/tidyverse:4.4.2 # Install Ubuntu distributions of R Packages RUN apt-get update From 2bfe48352ea7d7b106991a9bcac4792b4dfe4927 Mon Sep 17 00:00:00 2001 From: Nami Sunami Date: Sun, 26 Jan 2025 22:32:01 +0100 Subject: [PATCH 2/9] fix(Appendix): Remove caching --- 08-Appendix.qmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/08-Appendix.qmd b/08-Appendix.qmd index 194bad4..da98bf8 100644 --- a/08-Appendix.qmd +++ b/08-Appendix.qmd @@ -507,7 +507,7 @@ s1e_heart_plot I also explored whether participants reported different levels of need-threat between Time 3 and Time 5. Results are plotted in @fig-s1e-nts-across-time-plot. -```{r s1e-exploratory-NTS-mixed, cache=TRUE} +```{r s1e-exploratory-NTS-mixed} # Exploratory Mixed Model with Time -------------------------------------------- # run model NTS_vars <- c("nts_belonging_mean", "nts_esteem_mean", @@ -684,7 +684,7 @@ s2_mnsdcor %>% as_tibble() %>% ``` #### Bivariate Scatter Plot Matrix -```{r s2-matplot, fig.cap = "Matrix Plot for Study 2 Variables", fig.height=15, fig.width=15, message=FALSE, warning=FALSE, cache=TRUE} +```{r s2-matplot, fig.cap = "Matrix Plot for Study 2 Variables", fig.height=15, fig.width=15, message=FALSE, warning=FALSE} # Study 2 - Matrix Plot s2_df %>% select(essay_condition, T1_Heart_1, T1_Valence_1, T1_Arousal_1, T1_Dominance_1, @@ -900,7 +900,7 @@ s3_mnsdcor %>% as_tibble() %>% kable_styling_cortable() ``` -```{r appendix-s3-ggpairs, fig.cap='Study 3 - Bivariate Scatter Plot Matrix',fig.height=15, fig.width=15, out.width='100%', message=FALSE, warning=FALSE, cache=TRUE} +```{r appendix-s3-ggpairs, fig.cap='Study 3 - Bivariate Scatter Plot Matrix',fig.height=15, fig.width=15, out.width='100%', message=FALSE, warning=FALSE} # GG Pairs for Study 3 s3_df %>% select(parasocial, social_world, T1_Heart_1, T1_Valence_1, T1_Arousal_1, T1_Dominance_1, From b5c9c3bf82a1292bc288a785df25eaff01e4b64a Mon Sep 17 00:00:00 2001 From: Nami Sunami Date: Sun, 26 Jan 2025 22:37:28 +0100 Subject: [PATCH 3/9] fix(Appendix): Disable cache --- 08-Appendix.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/08-Appendix.qmd b/08-Appendix.qmd index fe00b78..3762dd4 100644 --- a/08-Appendix.qmd +++ b/08-Appendix.qmd @@ -691,7 +691,7 @@ s2_mnsdcor %>% as_tibble() %>% ``` #### Bivariate Scatter Plot Matrix -```{r s2-matplot, fig.cap = "Matrix Plot for Study 2 Variables", fig.height=15, fig.width=15, message=FALSE, warning=FALSE, cache=TRUE} +```{r s2-matplot, fig.cap = "Matrix Plot for Study 2 Variables", fig.height=15, fig.width=15, message=FALSE, warning=FALSE} #| label: fig-s2-matplot # Study 2 - Matrix Plot s2_df %>% @@ -908,7 +908,7 @@ s3_mnsdcor %>% as_tibble() %>% kable_styling_cortable() ``` -```{r appendix-s3-ggpairs, fig.cap='Study 3 - Bivariate Scatter Plot Matrix',fig.height=15, fig.width=15, out.width='100%', message=FALSE, warning=FALSE, cache=TRUE} +```{r appendix-s3-ggpairs, fig.cap='Study 3 - Bivariate Scatter Plot Matrix',fig.height=15, fig.width=15, out.width='100%', message=FALSE, warning=FALSE} # GG Pairs for Study 3 s3_df %>% dplyr::select(parasocial, social_world, T1_Heart_1, T1_Valence_1, T1_Arousal_1, T1_Dominance_1, From b92f7f015cbe62e9d6aad0b6e39cf53952a002cd Mon Sep 17 00:00:00 2001 From: Nami Sunami Date: Sun, 26 Jan 2025 22:42:59 +0100 Subject: [PATCH 4/9] chore(gitignore): Ignore rendered files but keep the directory --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index ef4280a..b4ebb88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # Ignore for publishing /.quarto/ /_site/ +# Ignore the rendered files but keep the directory +/docs/* +!docs/.keep .Rhistory .Rprofile From 913e7657f030a6d2e7152c95c2a88f194c18a03e Mon Sep 17 00:00:00 2001 From: Nami Sunami Date: Sun, 26 Jan 2025 22:44:13 +0100 Subject: [PATCH 5/9] chore(docs): keep the docs folder --- docs/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/.keep diff --git a/docs/.keep b/docs/.keep new file mode 100644 index 0000000..e69de29 From 208e71ba2e6513451f63e34c4c71679435001384 Mon Sep 17 00:00:00 2001 From: Nami Sunami Date: Sun, 26 Jan 2025 22:45:59 +0100 Subject: [PATCH 6/9] feat(Dockerfile): Setup docker as per renv --- Dockerfile | 118 +++++++++++++++++------------------------------------ 1 file changed, 37 insertions(+), 81 deletions(-) diff --git a/Dockerfile b/Dockerfile index d4a5f6c..3f28f32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,87 +1,43 @@ -FROM rocker/tidyverse:4.4.2 - -# Install Ubuntu distributions of R Packages -RUN apt-get update -RUN apt-get install -y zlib1g-dev -RUN -RUN install2.r -e here -RUN install2.r -e haven - -# xml2 -RUN apt-get install -y libxml2-dev -RUN install2.r -e xml2 - -# svg lite -RUN apt-get -y install libfontconfig1-dev -RUN install2.r -e svglite - -RUN install2.r -e patchwork -RUN install2.r -e table1 -RUN install2.r -e papaja -RUN install2.r -e kableExtra -RUN install2.r -e tidyr -RUN install2.r -e tibble - -RUN install2.r -e bookdown - - -RUN install2.r -e remotes -# ggtext -RUN apt-get -y install libcurl4-openssl-dev -RUN install2.r -e ggtext -RUN install2.r -e labelled - -# Install R packages on GitHub -RUN Rscript -e "remotes::install_github('achetverikov/APAstats')" +FROM rocker/rstudio:4.4.2 +# Install renv +RUN R -e "install.packages('renv', repos = c(CRAN = 'https://cloud.r-project.org'))" -RUN install2.r -e readr -RUN install2.r -e stringr -RUN install2.r -e purrr -RUN install2.r -e tinytex +# Get the renv files from the current project +RUN mkdir -p /project +WORKDIR /project +COPY renv.lock renv.lock +# Specify library paths for installation +RUN mkdir -p renv +COPY .Rprofile .Rprofile +COPY renv/activate.R renv/activate.R +COPY renv/settings.json renv/settings.json -RUN apt-get -y install libcairo2-dev libharfbuzz-dev libfribidi-dev -RUN apt-get -y install libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev -RUN install2.r -e flextable -RUN install2.r -e metathis -RUN install2.r -e Hmisc -RUN install2.r -e GGally -RUN install2.r -e corrr - -RUN apt-get -y install cmake -RUN install2.r -e lme4 - -RUN install2.r -e lmerTest -RUN install2.r -e forestplot -RUN install2.r -e broom.mixed -RUN install2.r -e ggpubr -RUN install2.r -e pacman - -RUN install2.r -e tidyverse -RUN install2.r -e rio - -RUN install2.r -e english -RUN install2.r -e sjlabelled -RUN install2.r -e sjPlot -RUN install2.r -e ggh4x -RUN install2.r -e knitcitations - - -RUN install2.r -e wordcloud -RUN install2.r -e emmeans -RUN install2.r -e tidytext -RUN install2.r -e ggmosaic -RUN install2.r -e broom -RUN install2.r -e codebook -RUN install2.r -e effectsize +# Install system dependencies +RUN apt-get update +## xml2 +RUN apt-get install -y libxml2-dev +## png +RUN apt-get install -y libpng-dev +## curl +RUN apt-get install -y libcurl4-openssl-dev +## cmake (for nloptr) +RUN apt-get install -y cmake +## gert +RUN apt-get install -y libgit2-dev +## systemfonts +RUN apt-get install -y libfontconfig1-dev +## Other dependencies +RUN apt-get install -y libcairo2-dev libharfbuzz-dev libfribidi-dev +RUN apt-get install -y libfreetype6-dev libtiff5-dev libjpeg-dev + +# Restore the packages via renv +RUN R -e "renv::restore()" + +# Install knitr and rmarkdown packages +RUN R -e "install.packages('knitr', repos = c(CRAN = 'https://cloud.r-project.org'))" +RUN R -e "install.packages('rmarkdown', repos = c(CRAN = 'https://cloud.r-project.org'))" # Install tinytex as the rstudio user -USER rstudio -RUN Rscript -e "tinytex::install_tinytex(force = TRUE)" -ENV PATH="${PATH}:/home/rstudio/bin" - -# Start the RStudio server as root -USER root -ENV USER=rstudio -CMD ["/usr/lib/rstudio-server/bin/rserver","--server-daemonize=0","--auth-none=1"] \ No newline at end of file +RUN Rscript -e "tinytex::install_tinytex(force = TRUE)" \ No newline at end of file From ca41d6c56cfa8eecec7ec3e50a5955523e814a65 Mon Sep 17 00:00:00 2001 From: Nami Sunami Date: Sun, 26 Jan 2025 22:49:05 +0100 Subject: [PATCH 7/9] feat(docker-compose.yml): compose up will render the project by default --- docker-compose.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b03fe68..7c26355 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,17 @@ services: - 8787:8787 volumes: - ./:/home/rstudio/dissertation/ - environment: - - PASSWORD=changeme # default username is rstudio - + working_dir: /home/rstudio/dissertation + command: quarto render # Render the book + ## To launch RStudio server use the command & environment below + ## ------------------------- + # user: root # For launching RStudio server + # command: + # [ + # "/usr/lib/rstudio-server/bin/rserver", + # "--server-daemonize=0", + # "--auth-none=1", + # ] + # environment: + # - PASSWORD=changeme # default username is rstudio + # - USER=root # For launching RStudio server From 5e015588c09d001c0451437aa54c19c4de0fecb3 Mon Sep 17 00:00:00 2001 From: Nami Sunami Date: Sun, 26 Jan 2025 22:49:55 +0100 Subject: [PATCH 8/9] chore(packages.bib): Update the dependency references --- packages.bib | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/packages.bib b/packages.bib index bea5f6b..8f164ab 100644 --- a/packages.bib +++ b/packages.bib @@ -1,9 +1,9 @@ @Manual{R-apastats, title = {apastats: APA-style results}, author = {Andrey Chetverikov}, - year = {2025}, note = {R package version 0.5, commit acbf761e3f66643c96e9b6ad65fdcd4af01382ed}, url = {https://github.com/achetverikov/APAstats}, + year = {2025}, } @Manual{R-base, @@ -174,14 +174,6 @@ @Manual{R-lme4 url = {https://github.com/lme4/lme4/}, } -@Manual{R-lubridate, - title = {lubridate: Make Dealing with Dates a Little Easier}, - author = {Vitalie Spinu and Garrett Grolemund and Hadley Wickham}, - year = {2024}, - note = {R package version 1.9.4}, - url = {https://lubridate.tidyverse.org}, -} - @Manual{R-Matrix, title = {Matrix: Sparse and Dense Matrix Classes and Methods}, author = {Douglas Bates and Martin Maechler and Mikael Jagan}, @@ -253,14 +245,6 @@ @Manual{R-tidytext url = {https://juliasilge.github.io/tidytext/}, } -@Manual{R-tidyverse, - title = {tidyverse: Easily Install and Load the Tidyverse}, - author = {Hadley Wickham}, - year = {2023}, - note = {R package version 2.0.0}, - url = {https://tidyverse.tidyverse.org}, -} - @Manual{R-wordcloud, title = {wordcloud: Word Clouds}, author = {Ian Fellows}, @@ -333,17 +317,6 @@ @Article{lme42015 doi = {10.18637/jss.v067.i01}, } -@Article{lubridate2011, - title = {Dates and Times Made Easy with {lubridate}}, - author = {Garrett Grolemund and Hadley Wickham}, - journal = {Journal of Statistical Software}, - year = {2011}, - volume = {40}, - number = {3}, - pages = {1--25}, - url = {https://www.jstatsoft.org/v40/i03/}, -} - @Article{tidytext2016, title = {tidytext: Text Mining and Analysis Using Tidy Data Principles in R}, author = {Julia Silge and David Robinson}, @@ -356,14 +329,3 @@ @Article{tidytext2016 journal = {JOSS}, } -@Article{tidyverse2019, - title = {Welcome to the {tidyverse}}, - author = {Hadley Wickham and Mara Averick and Jennifer Bryan and Winston Chang and Lucy D'Agostino McGowan and Romain François and Garrett Grolemund and Alex Hayes and Lionel Henry and Jim Hester and Max Kuhn and Thomas Lin Pedersen and Evan Miller and Stephan Milton Bache and Kirill Müller and Jeroen Ooms and David Robinson and Dana Paige Seidel and Vitalie Spinu and Kohske Takahashi and Davis Vaughan and Claus Wilke and Kara Woo and Hiroaki Yutani}, - year = {2019}, - journal = {Journal of Open Source Software}, - volume = {4}, - number = {43}, - pages = {1686}, - doi = {10.21105/joss.01686}, -} - From 8ec78c2b3c9a503c1ef99e983484b4896a1857ab Mon Sep 17 00:00:00 2001 From: Nami Sunami Date: Sun, 26 Jan 2025 22:52:00 +0100 Subject: [PATCH 9/9] fix(Dockerfile): Skip using .Rprofile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3f28f32..1ef5cc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,6 @@ COPY renv.lock renv.lock # Specify library paths for installation RUN mkdir -p renv -COPY .Rprofile .Rprofile COPY renv/activate.R renv/activate.R COPY renv/settings.json renv/settings.json