git clone [SSH_ADDRESS] ~/203b-hw
Lab 2: Getting Started With Homework
Biostat 203B
This tutorial assumes that you have already installed R, RStudio, and Git on your computer. If not, please refer to the Lab 1.
1 Set up GitHub repo for 203B homework
On https://github.com/, create a private repository
biostat-203b-2024-winter
and addHua-Zhou
and TA team (Tomoki-Okuno
for Lec 1;jonathanhori
andjasenzhang1
for Lec 80) as your collaborators with write permission. This repository is for submitting your 203B homework.You can use RStudio to git clone the
biostat-203b-2024-winter
repository to your local machine:File
->New Project...
->Version Control
->Git
-> inputRepository URL:
,Project directory name:
(203b-hw).Alternatively, in Terminal (Mac Terminal, Windows Git Bash, or Windows WSL), you can run
to clone your homework repository to a folder called 203b-hw
under your home directory on your computer. [SSH_ADDRESS]
is obtained by clicking the menu <> Code
-> SSH
on the repository page on GitHub. Then you can double click the biostat-203b-2024-winter.Rproj
file to open the RStudio project.
2 MIMIC Data
Much of homework and exercises are demonstrated on the MIMIC-IV v2.2 data set. Download the data to your computer from here (7.69 GB), and make it available at ~/mimic
. For example, you can create a symbolic link by
ln -s /PATH/TO/YOUR/MIMIC_FOLDER ~/mimic
Your homework solution should always read data from ~/mimic
. This is critical for TA team to reproduce your homework.
ls -l ~/mimic/
total 24
-rw-r--r-- 1 504 rstudio 13332 Jan 5 2023 CHANGELOG.txt
drwxr-xr-x 24 504 rstudio 768 Jan 4 22:18 hosp
drwxr-xr-x 11 504 rstudio 352 Nov 24 19:34 icu
-rw-r--r-- 1 504 rstudio 2518 Jan 6 2023 LICENSE.txt
-rw-r--r-- 1 504 rstudio 2884 Jan 6 2023 SHA256SUMS.txt
3 Start with homework 1
On your local machine:
- Clone the repository, create
develop
branch, where your work on solutions.
```{bash}
#| eval: false
# clone the project
git clone git@github.com:[USERNAME]/biostat-203b-2024-winter.git
# enter project folder
cd biostat-203b-2024-winter
# what branches are there?
git branch
# create develop branch
git branch develop
# switch to the develop branch
git checkout develop
# create folder for HW1
mkdir hw1
cd hw1
# let's write solutions
echo "sample solution" > hw1.Rmd
echo "some bug" >> hw1.Rmd
# commit the code
git add hw1.Rmd
git commit -m "start working on problem #1"
# push to remote repo
git push
```
- Submit and tag HW1 solution to the
main
branch.
```{bash}
#| eval: false
# which branch are we in?
git branch
# change to the main branch
git checkout main
# merge develop branch to main branch
# git pull origin develop
git merge develop
# push to the remote main branch
git push
# tag version hw1
git tag hw1
git push --tags
```
- RStudio has good Git integration. But practice command line operations also.
4 Homework 1
- Demo Q2, Q3.1, Q3.2, Q5, Q6.