-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode_4.R
55 lines (37 loc) · 1.24 KB
/
code_4.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Welcome to the finale
# Packages ----------------------------------------------------------------
library(readxl)
library(ggplot2)
library(dplyr)
# Read In -----------------------------------------------------------------
# collect and homogenize data from
curveball_file <- "data/curveball.xlsx"
# get all of the sheets out of curveball
?excel_sheets
# read each sheet in separately as 'dat1', 'dat2' and 'dat3'
?read_excel
# sync the columns so they all match
?names
?rename
# stack the sheets together into one long data frame
?bind_rows
# See it -----------------------------------------------------------------
# exploratory viz and tables
# make a plot comparing treatments, show all data points
?ggplot
?geom_point
# remove two outlier rows/observations
?filter
# plot again and add a summary crossbar geom onto original
?stat_summary
# calculate a summary table with: n, average, standard deviation for each group
?group_by
?summarise
# Test it ----------------------------------------------------------------
# How confident are we in that difference?
# perform a 2-sample T-test (unpaired) using the formula argument
?t.test
# construct a linear model called 'mod' using the formula argument again
?lm
# explore 'mod' for insights
?summary