Skip to content

Commit

Permalink
Merge pull request #1 from PSYC-259-Data-Science/master
Browse files Browse the repository at this point in the history
Merge up from class to include binder stuff
  • Loading branch information
JohnFranchak authored Feb 5, 2021
2 parents 6b59842 + 05ee26c commit cd4fc83
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 9 deletions.
5 changes: 4 additions & 1 deletion 01_vocab.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ library(visdat) #Means "visualize data"

rm(list = ls()) #clean variables out of environment

ds <- read_csv('vocab.csv')
getwd()

#Read the data file (all defaults work so all we need is a filename)
ds <- read_csv('data_raw/vocab.csv')

#Look at whole dataset, check basic assumptions
#Check for 'missing' values
vis_miss(ds)

#Wide to long (we'll go over this next week)
Expand Down
8 changes: 4 additions & 4 deletions 02_eye_tracking_basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ ds %>% ggplot(aes(x = por_x, y = por_y)) +
#Were they parsed correctly? Yes
vis_dat(ds)

#Let's set bad values to missing and save to a ds_cleaned tibble
#Let's set bad values to missing and save to a ds_cleaned tibble
#(more on this next week)
ds_cleaned <- ds %>%
mutate(por_x = ifelse(por_x < 0 | por_x > 640, NA, por_x),
por_y = ifelse(por_y < 0 | por_y > 480, NA, por_y))
Expand All @@ -38,15 +39,14 @@ ds_cleaned %>%
theme_minimal()

#Save the plot to eda as a data check
ggsave(paste0("eda/et_distribution_figs/",id,"_check.png"), width = 8, height = 6, units = "in")
ggsave(paste0("eda/et_distribution_figs/101_check.png"), width = 8, height = 6, units = "in")

#Let's also add a row with the subject id to the data file
ds_cleaned <- ds_cleaned %>%
add_column(id = 101, .before = "record_frames")

#Decide what to save
#Drop NA?
#ds_cleaned <- ds_cleaned %>% drop_na() #Is this actually a good idea?
ds_cleaned <- ds_cleaned %>% select(record_frame_count:pupil_y)

#Write to file
ds_cleaned %>% write_csv("data_cleaned/101.csv")
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<!-- badges: start -->
[![Launch Rstudio Binder](http://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/JohnFranchak/259-files-import/master?urlpath=rstudio)
<!-- badges: end -->

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/PSYC-259-Data-Science/259-files-import.git/HEAD?urlpath=rstudio)

<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.

# 259-files-import

This is a tutorial for reading data into R from various types of files using tidyverse functions. The scripts (01-03) are increasingly advanced to show a range of examples from simple to more involved data import.
Binary file modified data_cleaned/101.RData
Binary file not shown.
2 changes: 1 addition & 1 deletion data_cleaned/vocab.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ age,word
13.5,cat
14,baby
14.5,socks/shoes
14.5,dog
14.5,dog (animal)
15,banana
15,llama
15.5,cheese
Expand Down
Binary file modified eda/et_distribution_figs/101_check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions install.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install.packages("janitor")
install.packages("stringr")
install.packages("tidyverse")
install.packages("visdat")
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
r-2021-01-01

0 comments on commit cd4fc83

Please sign in to comment.