Skip to content

Instantly share code, notes, and snippets.

@carlislerainey
Last active January 30, 2017 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlislerainey/fc7209627f2854f76b16f9c3d8678355 to your computer and use it in GitHub Desktop.
Save carlislerainey/fc7209627f2854f76b16f9c3d8678355 to your computer and use it in GitHub Desktop.
Code to read the handedness data collected a survey.
# 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