Last active
January 30, 2017 13:47
-
-
Save carlislerainey/fc7209627f2854f76b16f9c3d8678355 to your computer and use it in GitHub Desktop.
Code to read the handedness data collected a survey.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this code uses the googlesheets package, which you may need to install using install.packages("googlesheets") | |
# load packages | |
library(googlesheets) # used to load the google sheet data | |
library(ggplot2) # used to create graphics | |
# register google sheet | |
sheet <- gs_key("1_bGZNmVkT2NBxJd-vQdqmy75UgFtIJ-E0m6mK7eRXyk") | |
# load handedness data | |
handedness_data <- gs_read(sheet) | |
# quick look at data | |
tibble::glimpse(handedness_data) | |
# histogram with base R graphics | |
hist(handedness_data$handedness) | |
# histogram with ggplot2 | |
ggplot(data = handedness_data, aes(x = handedness)) + # set data and aesthetics | |
geom_histogram() + # set geometry | |
labs(x = "Handedness", # improve labels | |
y = "Count", | |
title = "Distribution of Handedness Scores") + | |
theme_bw() # nicer looking theme |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment