Skip to content

Commit

Permalink
Merge pull request #63 from OxfordIHTM:dev
Browse files Browse the repository at this point in the history
edit chapter 9; fix edit chapter 9; fix #38
  • Loading branch information
ernestguevarra authored Sep 9, 2024
2 parents 92245e0 + 05d513c commit 2d2a886
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 27 deletions.
57 changes: 31 additions & 26 deletions 09-initiating-rstudio-project.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,78 @@ output-file: initiating-rstudio-project.html

Following is a diagram of the steps in initiating your own R/RStudio project.

![](images/git_process2.png)
<!--- ![](images/git_process2.png) -->

## 1. Create a new project in RStudio
```{mermaid}
%%| label: initiate-project-workflow
%%| fig-cap: A flowchart for initiating an R project
%%| fig-align: center
%%| file: mermaid/create-new-project.mmd
```

## Create a new project in RStudio

### 1.1 Click on **New Project** button on RStudio
### Click on New Project button on RStudio

![](images/new_project1.png)

![](images/new_project2.png)

### 1.2 Create a **New Directory**
### Create a New Directory

![](images/new_project3.png)

### 1.3 Select **New Project** as project type
### Select New Project as project type

![](images/new_project4.png)

### 1.4 Specify details for new project
### Specify details for new project

![](images/new_project5.png)

1.4.1 Specify a project name. Best practices for naming a project are:
#### Specify a project name {.unnumbered}

::: {.callout-note}
Best practices for naming a project are:

* Make sure that name is succinct (as short as possible while at the same time descriptive of the project);
* Don't use spaces for your project name. If you need to separate words, use a **dash** or an **underscore**;
* Don't use spaces for your project name. If you need to separate words, use a ***hyphen*** or an ***underscore***;
* Avoid using capital letters.
:::

#### Specify a directory/location {.unnumbered}

1.4.2 Specify a directory/location in your local machine where to place the directory of your new project
Select a directory in your local machine where to place the directory of your new project

1.4.3 Decide whether to use git to version this project
#### Decide whether to use git to version this project {.unnumbered}

Here you can decide whether you want to use `git` to version your project. Remember that using `git` doesn't mean you have to use GitHub. `git` is software installed in your local machine and it versions what you have on your local machine. You don't need `GitHub` or any other similar service to version your code with `git` in your local machine.
Here you can decide whether you want to use git to version your project. Remember that using git doesn't mean you have to use GitHub. git is software installed in your local machine and it versions what you have on your local machine. You don't need GitHub or any other similar service to version your code with git in your local machine.

I would recommend that you tick this option for any new project you create so that you can version your work in your local machine even if you don't want or decide not to use `GitHub` or any other remote `git` service.
I would recommend that you tick this option for any new project you create so that you can version your work in your local machine even if you don't want or decide not to use GitHub or any other remote git service.

1.4.4 Do you want to open a new session
#### Do you want to open a new session {.unnumbered}

This is by default unticked and will open the new project within the existing RStudio session (if any). This means that if you have an existing RStudio session with another project that you are working on, that project will be closed and the new project you are creating will open in the existing RStudio session.

If you need your existing RStudio session and the project within it to remain open alongside the new project you are creating, tick this box/option.

1.4.4 Click on **Create New Project**
#### Click on Create New Project {.unnumbered}

Once you click on **Create New Project**, you will now see the new project open in RStudio.
Once you click on ***Create New Project***, you will now see the new project open in RStudio.

You will also see something like below witin the file explorer pane of RStudio.

![](images/new_project6.png)

## 2. Structure/organise your new project appropriately

::: {.callout-note}
Project organisation is vital because:

* supports productivity because the different components of the project are placed in directories where they should be;
* enables clarity in communicating project structure;
* facilitates collaboration.
:::

Organising an R project can be user- and project-dependent but there are generally accepted project organising structure that is common to most well-organised projects. Below is an example:

Expand All @@ -87,14 +102,4 @@ This will include creating bespoke R functions (as required) and creating an Rsc

## Next steps

The next steps will depend on whether you will use `git` and `GitHub` for versioning your project and whether or not you will work on your project as a solo scientiest or work and collaborate with other scientists.










The next steps will depend on whether you will use git and GitHub for versioning your project and whether or not you will work on your project as a solo scientiest or work and collaborate with other scientists.
20 changes: 20 additions & 0 deletions mermaid/create-new-project.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
flowchart LR
create(create\nnew\nRStudio\nproject)
organise(organise\nproject\nfile\nstructure)
code(code/\nmake\nchanges)
commit(commit)
github{use\nGitHub?}
push(push)
collaborate{collaborate?}
add_collaborators(add\ncollaborators)
self_review(self-review\nautomated\nchecks)

create --> organise
organise --> code
code --> commit
commit --> github
github -- YES --> push
github -- NO --> code
push --> collaborate
collaborate -- YES --> add_collaborators
collaborate -- NO --> self_review
2 changes: 1 addition & 1 deletion mermaid/git-workflow.mmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flowchart TB
flowchart LR
clone(clone)
branch(branch)
changes("Code/make\nchanges")
Expand Down

0 comments on commit 2d2a886

Please sign in to comment.