Objectives
By the end of this assignment, you should:
add
and commit
to commit changespush
and pull
to make and receive changesThis assignment is due Thursday, October 7th at noon. Please turn your .html AND .Rmd files into Canvas. Your .Rmd file should knit without an error before turning in the assignment. Exercises 1-2 involve writing R code. The remaining exercises involve Git/Github. The exercises walk you through various steps for working with a repository. You only need to include something in the assignment you turn in when prompted (e.g., when it says something like, What does git print out?).
Load packages:
library(tidyverse)
library(knitr)
library(janitor)
In the first few exercises, we’ll try to reproduce some analyses from a published paper using the data from the OSF repo. In particular, we’ll try to reproduce the main analyses from Experiment 1A of Zettersten & Lupyan (2020).
CRN_data.txt
CRN_data.txt
from OSF into RStudio. There are two ways to do this. One way is to import it directly from the web. To do this, go to the CRN_data.txt page on OSF, right click (Control-click) on the “Download” button and select “copy link address”. The path to the file is the copied link address. Use this address to read the data into R (similar to how we’ve done in the previous assignments). Alternatively, you can download the file to your local computer and read the data into RStudio by providing the path to the file on your local computer. Save the data to a data frame called zl_data
. glimpse
to look at the data. How many variables are there? To find out what the variables mean, you can look at the codebook provided. zl_clean
). Use the clean_names
function from the janitor package to clean the variable names. Then, select only the variables that we’re going to need (experiment
, subject
, age
, condition
, block_num
, is_right
). zl_exp1a
) that only includes data from the experiment we need (Experiment 1A).
[a] Key question: How do linguistic labels influence category learning? Specifically, does nameability improve category learning?
How they tested this: Zetterson and Lupyan (2020) tested this by manipulating the nameability (low nameability and high nameability conditions) of the category features in a task of learning novel categories.
[d] There are 77 variables.
<- "https://osf.io/a4dzb/download"
DATA_PATH<- read_csv(DATA_PATH)
zl_data
<- zl_data %>%
zl_clean clean_names() %>%
select(experiment, subject, age, condition, block_num, is_right)
<- zl_clean %>%
zl_exp1a filter(experiment == "1A")
sum(is_right)/n()
)
[a] There were 50 participants.
distinct(zl_exp1a, subject) %>%
nrow()
## [1] 50
[b] The mean age was 32.02 years.
distinct(zl_exp1a, subject, .keep_all = T) %>%
summarize(mean_age = mean(age))
## # A tibble: 1 × 1
## mean_age
## <dbl>
## 1 32.0
[c] The accuracy was 0.84 in the high condition, and 0.677 in the low condition.
<- zl_exp1a %>%
ms_by_overall group_by(condition) %>%
summarize(prop_right = sum(is_right)/n())
ms_by_overall
## # A tibble: 2 × 2
## condition prop_right
## <chr> <dbl>
## 1 high 0.84
## 2 low 0.677
[d]
<- zl_exp1a %>%
ms_by_condition group_by(condition, block_num) %>%
summarize(prop_right = sum(is_right)/n())
## `summarise()` has grouped output by 'condition'. You can override using the `.groups` argument.
ggplot(ms_by_condition, aes(x = block_num, y = prop_right, color = condition)) +
geom_point() +
ylim(.5,1) +
scale_color_manual(values = c('red', "blue")) +
geom_line() +
geom_hline(yintercept = 0.50, color="gray")+
scale_x_continuous(breaks=c(1,2,3)) +
xlab("Block Number") +
ylab("Accuracy") +
theme_classic(base_size = 12)
The next exercises concern creating and cloning a new Github repo. The slides from lab describe the steps for completing these exercises.
git clone <URL>
to create a local copy of your repo (where <URL>
is the URL of the repo you want to clone, which typically looks like: https://github.com/<USERNAME>/<REPO_NAME>
(where <USERNAME>
is the username of your Github account). cd <REPO NAME>
. This is important.git config --global user.email "<EMAIL>"
(where <EMAIL>
is the email you used to create your Github account; be sure to include the quotes around your email). git config --global user.name "<NAME>"
(where <NAME>
is your name).
In the last few exercises, we’ll make a basic change to the repo, commit the change, and push it to Github.
git status
to check that Git has detected the change (make sure your current working directory is the repository). What does git print out? git add README.md
to add the file README.md to the current change. git status
again to check that the change is ready to be commited. What does git print out now?
[b]
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
[d]
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: README.md
git commit -m '<COMMIT_MSG>'
(where <COMMIT_MSG>
is a short message describing the change you made, e.g. “update readme”). git status
again to check that the change is committed. What does git print out now?
[b]
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
.jpg
, .png
, .pdf
). Rename the picture to include the function name, animal name, and your first name. (e.g. “filter_flamingo_molly.pdf”) git add <PICTURE FILENAME>
to add your animal file to the current change. git status
again to check that the change is ready to be committed. What does git print out now?
[d]
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: arrange_axolotl_jaeah.jpg
git commit -m '<COMMIT_MSG>'
(where <COMMIT_MSG>
is a short message describing the change you made). git status
again to check that the change is committed. What does git print out now?
[b]
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
git push
to push the change to Github. You will need to enter your Github username and password. The password is the personalized access token you just created, i.e., a long string of numbers and letters (not your Github password you create in Exercise 3). [c] Use git status
again to check that you’re in sync with Github. What does git print out? [d] Navigate to the project on Github and check that your changes were successfully pushed. What is the link to your repo on Github?
[c]
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
[d] The git repository link: https://github.com/jaeahk/MRM-Assignment-04
.