-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
104 lines (104 loc) · 2.75 KB
/
.Rhistory
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
library("tidyr")
library("tidyr")
help(package = "tidyr")
help(package = "tidyr")
read.csv("preg.csv", stringsAsFactors = FALSE)
?system.file
system.file(package="tidyr")
system.file(package="tidyr","vignettes/preg.csv")
preg <- paste0(vignette_url,"preg.csv")
vignette_url <- "https://github.com/hadley/tidyr/tree/master/vignettes"
preg <- paste0(vignette_url,"preg.csv")
read.csv(preg)
preg <- paste(vignette_url,"preg.csv",sep="/")
preg <- paste(vignette_url,"preg.csv",sep="/")
read.csv(preg)
vignette_url <- "https://raw.githubusercontent.com/hadley/tidyr/master/vignettes/"
preg <- paste0(vignette_url,"preg.csv")
preg <- read.csv(preg)
preg
paste("string1","string2")
paste0("string1","string2")
ls()
library("tidyr")
vignette_url <- "https://raw.githubusercontent.com/hadley/tidyr/master/vignettes/"
ls()
preg_path <- paste0(vignette_url,"preg.csv")
preg <- read.csv(preg_path)
preg
vignette_url <- "https://raw.githubusercontent.com/hadley/tidyr/master/vignettes/"
preg_path <- paste0(vignette_url,"preg.csv")
preg <- read.csv(preg_path)
preg
help(package="tidyr")
str(preg)
preg
install.packages("dplyr")
library("dplyr")
preg
preg %>%
gather(treatment, n, treatmenta:treatmentb)
?gsub
preg2 <- preg %>%
gather(treatment, n, treatmenta:treatmentb) %>%
mutate(treatment = gsub("treatment", "", treatment)) %>%
arrange(name, treatment)
preg2
preg %>%
preg
preg2
lm(n~treatment+name)
lm(n~treatment+name,data=preg2)
name
name
named_commas()
lm(n~treatment,data=preg2)
summary(lm(n~treatment,data=preg2))
aov(lm(n~treatment,data=preg2))
summary(aov(lm(n~treatment,data=preg2)))
summary(lm(n~treatment,data=preg2))
#Required packages
#############
#mean(rnorm(100))
mean(rnorm(100))
#mean(rnorm(100))
#set.seed(1)
mean(rnorm(100))
#set.seed(1)
mean(rnorm(100))
set.seed(1)
mean(rnorm(100))
set.seed(1)
set.seed(1)
mean(rnorm(100))
vignettes()
vignette("tidy-data")
pew_path <- paste0(vignette_url, "pew.csv")
library("tidyr")
library("dplyr")
#Grab csv from GitHub (not readily availble on local)
vignette_url <- "https://raw.githubusercontent.com/hadley/tidyr/master/vignettes/"
preg_path <- paste0(vignette_url, "preg.csv")
preg <- read.csv(preg_path, stringsAsFactors = FALSE)
preg2 <- preg %>%
gather(treatment, n, treatmenta:treatmentb) %>%
mutate(treatment = gsub("treatment", "", treatment)) %>%
arrange(name, treatment)
pew_path <- paste0(vignette_url, "pew.csv")
pew <- read.csv(pew_path, stringsAsFactors = FALSE)
pew
tbl_df(pew)
library("tidyr")
library("dplyr")
preg_path <- paste0(vignette_url, "preg.csv")
preg <- read.csv(preg_path, stringsAsFactors = FALSE)
preg
preg
preg2 <- preg %>%
gather(treatment, n, treatmenta:treatmentb) %>%
mutate(treatment = gsub("treatment", "", treatment)) %>%
arrange(name, treatment)
preg2
preg2 <- preg %>%
gather(treatment, n, treatmenta:treatmentb)
preg2