diff --git a/.nojekyll b/.nojekyll index cb48887..e01fdd7 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -3313e520 \ No newline at end of file +641b0796 \ No newline at end of file diff --git a/appendix.html b/appendix.html index 957c8ed..9fde1cb 100644 --- a/appendix.html +++ b/appendix.html @@ -2,7 +2,7 @@ - + diff --git a/contributing.html b/contributing.html index fead560..4591b57 100644 --- a/contributing.html +++ b/contributing.html @@ -2,7 +2,7 @@ - + diff --git a/datasets.html b/datasets.html index a57ccf1..f677ab4 100644 --- a/datasets.html +++ b/datasets.html @@ -2,7 +2,7 @@ - + diff --git a/describe.html b/describe.html index 4c27d03..9229ee9 100644 --- a/describe.html +++ b/describe.html @@ -2,7 +2,7 @@ - + diff --git a/images/ghd_shortcuts.png b/images/ghd_shortcuts.png new file mode 100644 index 0000000..f8c1399 Binary files /dev/null and b/images/ghd_shortcuts.png differ diff --git a/import.html b/import.html index 52d3da6..e27d74d 100644 --- a/import.html +++ b/import.html @@ -2,7 +2,7 @@ - + @@ -298,7 +298,7 @@

4 Packages for th
library(haven)
 library(sjPlot)
-
#refugeeswelcome
+
Learn more about sjPlot with 'browseVignettes("sjPlot")'.
# remotes::install_github("martinctc/surveytoolbox")
 library(surveytoolbox)
@@ -382,8 +382,7 @@

5 Read in the dat
view_df(data_cleanednames)
-
- +
@@ -505,11 +504,9 @@

5 Read in the dat

Data frame: data_cleanednames
-
view_df(data_cleanednames, file=here("output_files","spsstest_codebook.html"))
-
- +
@@ -632,7 +629,6 @@

5 Read in the dat

Data frame: data_cleanednames
-

The data_dict function from surveytoolbox makes a dataframe with all the variable and response labels - similar to the html created above, but this can be called upon later in R as it’s now part of the environment.

datadictionary <- data_cleanednames %>%
diff --git a/index.html b/index.html
index de57515..81d0966 100644
--- a/index.html
+++ b/index.html
@@ -2,7 +2,7 @@
 
 
 
-
+
 
 
 
diff --git a/inferences.html b/inferences.html
index 230168d..9ac2b23 100644
--- a/inferences.html
+++ b/inferences.html
@@ -2,7 +2,7 @@
 
 
 
-
+
 
 
 
diff --git a/intro.html b/intro.html
index 2b2e0b2..778103d 100644
--- a/intro.html
+++ b/intro.html
@@ -2,7 +2,7 @@
 
 
 
-
+
 
 
 
diff --git a/maintain.html b/maintain.html
index 8ad893d..6b4d950 100644
--- a/maintain.html
+++ b/maintain.html
@@ -2,7 +2,7 @@
 
 
 
-
+
 
 
 
@@ -197,8 +197,11 @@ 

Table of contents

  • 8.0.1 Getting access
  • 8.0.2 The set up
  • 8.0.3 The Maintainer’s workflow
  • -
  • 8.0.4 {renv}: Managing R packages
  • -
  • 8.0.5 Book Structure
  • +
  • 8.0.4 Clone: Create a local copy of the book
  • +
  • 8.0.5 Branches: Create your own working copy
  • +
  • 8.0.6 Make your changes
  • +
  • 8.0.7 {renv}: Managing R packages
  • +
  • 8.0.8 Book Structure
  • @@ -271,10 +274,11 @@

    installing git and a git client. We will focus on using Github Desktop, but the main git commands should translate to whichever client you are using.

    -
    -

    8.0.3.1 Clone: Create a local copy of the book {sec-maintain-clone}

    +
    +
    +

    8.0.4 Clone: Create a local copy of the book

    Now that we have all the installation/setup out of the way, we can get started!

    -

    Lets first get you a local copy of the book onto your computer by “cloning” the repository

    +

    Lets get you a local copy of the book onto your computer by “cloning” the repository

    Head over to the remote repo for the book:

    1. Click on the big green button that says Code
    2. @@ -295,9 +299,9 @@

      Book Structure

    -
    -

    8.0.3.2 Branches: Create your own working copy {sec-maintain-branch}

    -

    As maintainers, we will work on branches. (internal copies of the book) so as to not overwrite each other’s work. This approach will also allow us to have a systematic way in introducing new content to the book. Coordinating collaborative changes on the same project is what GitHub does best.

    +
    +

    8.0.5 Branches: Create your own working copy

    +

    As maintainers, we will work on branches which are internal copies of the book. This is so we overwrite each other’s work. This approach will also allow us to have a systematic way in introducing new content to the book. Coordinating collaborative changes on the same project is what GitHub does best.

    The main branch is currently the most recent approved version of the book - this is displayed at https://unsw-edu-au.github.io/r4psych/

    When you clone a repository, the main branch is selected by default.

    To create your own branch:

    @@ -310,30 +314,90 @@

    -
  • Click on “Create Branch” and voila! Git will automatically switch from main to your branch for you.
  • +
  • Click on “Create Branch” and voila! Git will automatically switch from main to your branch for you.
  • At this stage, your branch exists locally on your computer, no where else.

    1. Next, we will click on “Publish branch”, this will make your branch available on the remote repo so we can formally incorporate its changes to the main once your edits are done. Publishing your branch also allows other maintainer’s see your progress.

    -
    -

    8.0.3.3 Make your changes {sec-maintain-edit}

    +
    +

    8.0.6 Make your changes

    +

    Now that you have our own internal copy of the book, you can freely make changes pertaining to the feature you want to work on.

    +

    Navigate to the local repo and click on the r4pysch.Rproj file. This will open up the project in RStudio.

    +

    You can also use the buttons in Github Desktop to quickly navigate to the project files.

    +

    #### Commit: A save point for your work {#sec-maintain-commit}

    +

    Now let’s make a change to a chapter. As an example, correct a typo, or add some punctuation. Go for it!

    +

    Before we launch into actual edits to the book, let’s talk about how R packages are managed for this book. This is important since this is a book about using R and you will most definitely introduce packages in certain chapters. Its also important as the book gains more maintainers working across different computers.

    -
    -

    8.0.3.4 Create a pull request {sec-maintain-pr}

    +
    +

    8.0.7 {renv}: Managing R packages

    +

    We use renv to manage the R packages that are used by the book across different R versions and operating systems. renv uses a package cache. That means you only ever have to download and install a package once, and for each subsequent install!

    +

    Learn more from the renv website

    +

    Briefly, renv monitors and installs any R packages that are used in a project. renv records this information so that anyone opening up this book will have access to the same R package versions:

    +

    renv stores information in several places:

    +
      +
    • renv/library/ directory
    • +
    +

    Here you can see R packages for the different versions of R that was used during the creation of this book.

    +
      +
    • renv.lock
    • +
    +

    This is a lockfile and contains information about the R packages so that it can be re-installed on a new computer. The great thing about a lockfile is that you can share this which colleagues and they can use renv to reproduce the exact R package environment that was recorded.

    +
      +
    • .Rprofile This is a project profile and it is run automatically every time you start R. renv uses it to configure your R session to use the project library in renv/library/.
    • +
    +
    +

    8.0.7.1 {renv} workflow

    +

    We are going to learn some new renv lingo so help us manage our R package environment.

    +
    +
    8.0.7.1.1 When you open up the project
    +

    Each time you open this book project up run:

    +
    +
    +
    - The library is already synchronized with the lockfile.
    +
    +
    +

    This will prompt renv to check and install any R packages that you may not have locally. If you have all the packages installed already, renv will tell you you’re synchronised.

    +
    +
    +
    8.0.7.1.2 When you want to add R packages
    +

    Over time, our book will need more packages. You can continue to use familiar tools like install.packages(). You can also use renv::install() it’s a little less typing and can install packages from GitHub, Bioconductor, and more, not just CRAN. Ta-da!

    +
    +
    +
    The following package(s) will be installed:
    +- janitor [2.2.0]
    +These packages will be installed into "~/work/r4psych/r4psych/renv/library/R-4.4/x86_64-pc-linux-gnu".
    +
    +# Installing packages --------------------------------------------------------
    +- Installing janitor ...                        OK [linked from cache]
    +Successfully installed 1 package in 5.5 milliseconds.
    +
    +
    +

    After installing the package and checking that your code works, you should call renv::snapshot() to record the latest package versions in your lockfile. You’ll need to commit those changes to git and let your collaborators know that you’ve updated the lockfile and they should call renv::restore() when they’re next working on a project.

    +
    +
    +
    + +
    +
    +Note +
    +
    +
    +

    This is why its good practice to call renv::restore() each time you open the project

    +
    +
    -
    -

    8.0.4 {renv}: Managing R packages

    -
    -

    8.0.4.1 {renv} workflow

    +
    +

    8.0.7.2 Create a pull request

    -
    -

    8.0.5 Book Structure

    +
    +

    8.0.8 Book Structure

    diff --git a/organise.html b/organise.html index 3917c24..ca6d68e 100644 --- a/organise.html +++ b/organise.html @@ -2,7 +2,7 @@ - + diff --git a/plot.html b/plot.html index 783c8bc..71aa683 100644 --- a/plot.html +++ b/plot.html @@ -2,7 +2,7 @@ - + diff --git a/references.html b/references.html index b74e831..8bab374 100644 --- a/references.html +++ b/references.html @@ -2,7 +2,7 @@ - + diff --git a/search.json b/search.json index 0f418cd..a12d19d 100644 --- a/search.json +++ b/search.json @@ -124,7 +124,7 @@ "href": "import.html", "title": "3  Import", "section": "", - "text": "4 Packages for this chapter\nlibrary(tidyverse)\n\n── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──\n✔ dplyr 1.1.4 ✔ readr 2.1.5\n✔ forcats 1.0.0 ✔ stringr 1.5.1\n✔ ggplot2 3.5.1 ✔ tibble 3.2.1\n✔ lubridate 1.9.3 ✔ tidyr 1.3.1\n✔ purrr 1.0.2 \n── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──\n✖ dplyr::filter() masks stats::filter()\n✖ dplyr::lag() masks stats::lag()\nℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors\n\nlibrary(here)\n\nhere() starts at /home/runner/work/r4psych/r4psych\n\nlibrary(janitor)\n\n\nAttaching package: 'janitor'\n\nThe following objects are masked from 'package:stats':\n\n chisq.test, fisher.test\n\nlibrary(haven)\nlibrary(sjPlot)\n\n#refugeeswelcome\n\n# remotes::install_github(\"martinctc/surveytoolbox\")\nlibrary(surveytoolbox)", + "text": "4 Packages for this chapter\nlibrary(tidyverse)\n\n── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──\n✔ dplyr 1.1.4 ✔ readr 2.1.5\n✔ forcats 1.0.0 ✔ stringr 1.5.1\n✔ ggplot2 3.5.1 ✔ tibble 3.2.1\n✔ lubridate 1.9.3 ✔ tidyr 1.3.1\n✔ purrr 1.0.2 \n── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──\n✖ dplyr::filter() masks stats::filter()\n✖ dplyr::lag() masks stats::lag()\nℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors\n\nlibrary(here)\n\nhere() starts at /home/runner/work/r4psych/r4psych\n\nlibrary(janitor)\n\n\nAttaching package: 'janitor'\n\nThe following objects are masked from 'package:stats':\n\n chisq.test, fisher.test\n\nlibrary(haven)\nlibrary(sjPlot)\n\nLearn more about sjPlot with 'browseVignettes(\"sjPlot\")'.\n\n# remotes::install_github(\"martinctc/surveytoolbox\")\nlibrary(surveytoolbox)", "crumbs": [ "3  Import" ] @@ -294,7 +294,7 @@ "href": "maintain.html", "title": "8  Maintainer’s Guide", "section": "", - "text": "8.0.1 Getting access\nFirst, let’s make sure you have collaborator access to the repository.\n\nHead over to your repository settings\nIf you see unsw-edu-au and the repo name: unsw-edu-au/r4psych in the list then you have collaborator access to the repository.\n\n\nIf you don’t, let’s go through how you can request an invite to be a collaborator\n\n8.0.1.1 Request access\nCreate an issue requesting for collaborator access and one of the maintainers with admin rights will send through an invite.\n\n\n\n8.0.2 The set up\nThe set up for maintainer’s is the same for contributors. Check out the following sections to get started:\n\nInstall Quarto\nGitHub Workflow\n\n\n\n8.0.3 The Maintainer’s workflow\nThe maintainer’s workflow goes like this:\n\nYou clone the remote repo\nYou create a new feature branch.\nYou work on your branch and make your edits, you commit regularly, you push regularly to the remote.\nWhen you are happy with your changes, you will create a pull request for your contribution and one of the other maintainers will review it. Edits may be requested or one of the maintainers will make the changes after having a conversation with you.\nOnce everything and everyone is happy and dandy with the final changes, your changes will be approved and merged into main. When this happens, your branch is deleted on the remote and you will also delete it locally.\n\nThis workflow treats branches as temporary entities and will keeps the remote tidy and streamlined.\nNow let’s walk through this workflow step by step.\n\n\n\n\n\n\nNote\n\n\n\nThe next sections assumes you’ve completed the initial set-up of installing git and a git client. We will focus on using Github Desktop, but the main git commands should translate to whichever client you are using.\n\n\n\n8.0.3.1 Clone: Create a local copy of the book {sec-maintain-clone}\nNow that we have all the installation/setup out of the way, we can get started!\nLets first get you a local copy of the book onto your computer by “cloning” the repository\nHead over to the remote repo for the book:\n\nClick on the big green button that says Code\n\n\nHere you will find a drop-down menu showing different methods of cloning the code from the remote repo.\nWe will stick with the default option of using HTTPS a.k.a. cloning by using the URL of the remote repo.\n\nClick on the copy URL button (The stacked squares icon)\nNavigate to Github Desktop and click on the first drop down menu from the left. Here you will find the Add button.\n\n\n\nClick on Add and then Clone Repository\nClick on the URL option and paste in the URL of this book’s remote repo e.g. https://github.com/unsw-edu-au/r4psych\nUnder Local Path, you can choose where you want to place this cloned repo. Avoid putting your repos in Cloud services such as Dropbox or Google Drive. These can sometimes interfere with git’s ability to track your changes.\nFinally, click Clone and let git do the work! It will copy everything that is in the remote repo and bring it down locally on your computer!\nNavigate to the local path where you told git to clone to in Step 7 and check out the directories. You will learn more about these in Book Structure\n\n\n\n8.0.3.2 Branches: Create your own working copy {sec-maintain-branch}\nAs maintainers, we will work on branches. (internal copies of the book) so as to not overwrite each other’s work. This approach will also allow us to have a systematic way in introducing new content to the book. Coordinating collaborative changes on the same project is what GitHub does best.\nThe main branch is currently the most recent approved version of the book - this is displayed at https://unsw-edu-au.github.io/r4psych/\nWhen you clone a repository, the main branch is selected by default.\nTo create your own branch:\n\nClick on the middle menu that says “Current branch main”\nClick on “New Branch”\n\n\n\nGive your branch a name.\n\nKeep it concise and related to the feature you are going to work on e.g restructure-wrangle. Separate words with a hyphen.\nAt the end of your branch name, put down your initials, that way other maintainers know who is working on which branch. e.g restructure-wrangle-fk\n\nClick on “Create Branch” and voila! Git will automatically switch from main to your branch for you.\n\nAt this stage, your branch exists locally on your computer, no where else.\n\nNext, we will click on “Publish branch”, this will make your branch available on the remote repo so we can formally incorporate its changes to the main once your edits are done. Publishing your branch also allows other maintainer’s see your progress.\n\n\n\n8.0.3.3 Make your changes {sec-maintain-edit}\n\n\n8.0.3.4 Create a pull request {sec-maintain-pr}\n\n\n\n8.0.4 {renv}: Managing R packages\n\n8.0.4.1 {renv} workflow\n\n\n\n8.0.5 Book Structure", + "text": "8.0.1 Getting access\nFirst, let’s make sure you have collaborator access to the repository.\n\nHead over to your repository settings\nIf you see unsw-edu-au and the repo name: unsw-edu-au/r4psych in the list then you have collaborator access to the repository.\n\n\nIf you don’t, let’s go through how you can request an invite to be a collaborator\n\n8.0.1.1 Request access\nCreate an issue requesting for collaborator access and one of the maintainers with admin rights will send through an invite.\n\n\n\n8.0.2 The set up\nThe set up for maintainer’s is the same for contributors. Check out the following sections to get started:\n\nInstall Quarto\nGitHub Workflow\n\n\n\n8.0.3 The Maintainer’s workflow\nThe maintainer’s workflow goes like this:\n\nYou clone the remote repo\nYou create a new feature branch.\nYou work on your branch and make your edits, you commit regularly, you push regularly to the remote.\nWhen you are happy with your changes, you will create a pull request for your contribution and one of the other maintainers will review it. Edits may be requested or one of the maintainers will make the changes after having a conversation with you.\nOnce everything and everyone is happy and dandy with the final changes, your changes will be approved and merged into main. When this happens, your branch is deleted on the remote and you will also delete it locally.\n\nThis workflow treats branches as temporary entities and will keeps the remote tidy and streamlined.\nNow let’s walk through this workflow step by step.\n\n\n\n\n\n\nNote\n\n\n\nThe next sections assumes you’ve completed the initial set-up of installing git and a git client. We will focus on using Github Desktop, but the main git commands should translate to whichever client you are using.\n\n\n\n\n8.0.4 Clone: Create a local copy of the book\nNow that we have all the installation/setup out of the way, we can get started!\nLets get you a local copy of the book onto your computer by “cloning” the repository\nHead over to the remote repo for the book:\n\nClick on the big green button that says Code\n\n\nHere you will find a drop-down menu showing different methods of cloning the code from the remote repo.\nWe will stick with the default option of using HTTPS a.k.a. cloning by using the URL of the remote repo.\n\nClick on the copy URL button (The stacked squares icon)\nNavigate to Github Desktop and click on the first drop down menu from the left. Here you will find the Add button.\n\n\n\nClick on Add and then Clone Repository\nClick on the URL option and paste in the URL of this book’s remote repo e.g. https://github.com/unsw-edu-au/r4psych\nUnder Local Path, you can choose where you want to place this cloned repo. Avoid putting your repos in Cloud services such as Dropbox or Google Drive. These can sometimes interfere with git’s ability to track your changes.\nFinally, click Clone and let git do the work! It will copy everything that is in the remote repo and bring it down locally on your computer!\nNavigate to the local path where you told git to clone to in Step 7 and check out the directories. You will learn more about these in Book Structure\n\n\n\n8.0.5 Branches: Create your own working copy\nAs maintainers, we will work on branches which are internal copies of the book. This is so we overwrite each other’s work. This approach will also allow us to have a systematic way in introducing new content to the book. Coordinating collaborative changes on the same project is what GitHub does best.\nThe main branch is currently the most recent approved version of the book - this is displayed at https://unsw-edu-au.github.io/r4psych/\nWhen you clone a repository, the main branch is selected by default.\nTo create your own branch:\n\nClick on the middle menu that says “Current branch main”\nClick on “New Branch”\n\n\n\nGive your branch a name.\n\nKeep it concise and related to the feature you are going to work on e.g restructure-wrangle. Separate words with a hyphen.\nAt the end of your branch name, put down your initials, that way other maintainers know who is working on which branch. e.g restructure-wrangle-fk\n\nClick on “Create Branch” and voila! Git will automatically switch from main to your branch for you.\n\nAt this stage, your branch exists locally on your computer, no where else.\n\nNext, we will click on “Publish branch”, this will make your branch available on the remote repo so we can formally incorporate its changes to the main once your edits are done. Publishing your branch also allows other maintainer’s see your progress.\n\n\n\n8.0.6 Make your changes\nNow that you have our own internal copy of the book, you can freely make changes pertaining to the feature you want to work on.\nNavigate to the local repo and click on the r4pysch.Rproj file. This will open up the project in RStudio.\nYou can also use the buttons in Github Desktop to quickly navigate to the project files.\n #### Commit: A save point for your work {#sec-maintain-commit}\nNow let’s make a change to a chapter. As an example, correct a typo, or add some punctuation. Go for it!\nBefore we launch into actual edits to the book, let’s talk about how R packages are managed for this book. This is important since this is a book about using R and you will most definitely introduce packages in certain chapters. Its also important as the book gains more maintainers working across different computers.\n\n\n8.0.7 {renv}: Managing R packages\nWe use renv to manage the R packages that are used by the book across different R versions and operating systems. renv uses a package cache. That means you only ever have to download and install a package once, and for each subsequent install!\nLearn more from the renv website\nBriefly, renv monitors and installs any R packages that are used in a project. renv records this information so that anyone opening up this book will have access to the same R package versions:\nrenv stores information in several places:\n\nrenv/library/ directory\n\nHere you can see R packages for the different versions of R that was used during the creation of this book.\n\nrenv.lock\n\nThis is a lockfile and contains information about the R packages so that it can be re-installed on a new computer. The great thing about a lockfile is that you can share this which colleagues and they can use renv to reproduce the exact R package environment that was recorded.\n\n.Rprofile This is a project profile and it is run automatically every time you start R. renv uses it to configure your R session to use the project library in renv/library/.\n\n\n8.0.7.1 {renv} workflow\nWe are going to learn some new renv lingo so help us manage our R package environment.\n\n8.0.7.1.1 When you open up the project\nEach time you open this book project up run:\n\n\n- The library is already synchronized with the lockfile.\n\n\nThis will prompt renv to check and install any R packages that you may not have locally. If you have all the packages installed already, renv will tell you you’re synchronised.\n\n\n8.0.7.1.2 When you want to add R packages\nOver time, our book will need more packages. You can continue to use familiar tools like install.packages(). You can also use renv::install() it’s a little less typing and can install packages from GitHub, Bioconductor, and more, not just CRAN. Ta-da!\n\n\nThe following package(s) will be installed:\n- janitor [2.2.0]\nThese packages will be installed into \"~/work/r4psych/r4psych/renv/library/R-4.4/x86_64-pc-linux-gnu\".\n\n# Installing packages --------------------------------------------------------\n- Installing janitor ... OK [linked from cache]\nSuccessfully installed 1 package in 5.5 milliseconds.\n\n\nAfter installing the package and checking that your code works, you should call renv::snapshot() to record the latest package versions in your lockfile. You’ll need to commit those changes to git and let your collaborators know that you’ve updated the lockfile and they should call renv::restore() when they’re next working on a project.\n\n\n\n\n\n\nNote\n\n\n\nThis is why its good practice to call renv::restore() each time you open the project\n\n\n\n\n\n8.0.7.2 Create a pull request\n\n\n\n8.0.8 Book Structure", "crumbs": [ "8  Maintainer's Guide" ] diff --git a/wrangle.html b/wrangle.html index a17ca64..6567321 100644 --- a/wrangle.html +++ b/wrangle.html @@ -2,7 +2,7 @@ - +