forked from barryclark/jekyll-now
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
169 lines (169 loc) · 8.02 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
rmd2md()
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
tidyverse::tidyverse_update()
source('~/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
install.packages("forcats")
Sys.timezones()
Sys.timezone()
install.packages(c("bookdown","prettydoc","rticles"))
install.packages(c("bookdown", "prettydoc", "rticles"))
knitr::opts_chunk$set(echo = TRUE)
sw_sent %>%
group_by(Speaker,id) %>%
summarize(speech_score=sum(score),speech_sent_words==sum(is_scored)) %>%
left_join(total_words,by="id") %>%
mutate(speech_score=speech_score/total,speech_sent_words=speech_sent_words/total) %>%
arrange(speech_score) %>%
print(n=nrow(.))
sw_sent <- speech_df %>%
mutate(id=factor(id)) %>%
unnest_tokens(word,text) %>%
inner_join(get_sentiments("bing")) %>%
mutate(score=(sentiment=="positive")-(sentiment=="negative"),is_scored=ifelse(sentiment %in% c("positive","negative"),1,0))
source('C:/Users/johnd/Documents/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
?opts_knit
source('C:/Users/johnd/Documents/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('C:/Users/johnd/Documents/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('C:/Users/johnd/Documents/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
source('C:/Users/johnd/Documents/GitHub/randomjohn.github.io/rmd2md.R', echo=TRUE)
install.packages(c("curl", "shiny"))
help(package="animation")
knitr::opts_chunk$set(echo = TRUE)
api_key <- "a83614a85254200e07d6e1f923d7989d55630543"
mapImage <- ggmap(get_googlemap(c(lon=-82.394012,lat=34.852619), scale=1, zoom=10), extent="normal")
library(ggmap)
mapImage <- ggmap(get_googlemap(c(lon=-82.394012,lat=34.852619), scale=1, zoom=10), extent="normal")
mapImage
library(ggmap)
mapImage <- ggmap(get_googlemap(c(lon=-82.394012,lat=34.852619), scale=1, zoom=10), extent="normal")
mapImage <- ggmap(get_googlemap(c(lon=-82.394012,lat=34.852619), scale=1, zoom=10))
mapImage <- ggmap(get_googlemap(c(lon=-82.394012,lat=34.852619), scale=1, zoom=10))
devtool::install_github("tidyverse/ggplot2")
devtools::install_github("tidyverse/ggplot2")
devtools::install_github("dkale/ggmap")
devtools::install_github("dkahle/ggmap")
knitr::opts_chunk$set(echo = TRUE)
api_key <- "a83614a85254200e07d6e1f923d7989d55630543"
mapImage <- ggmap(get_googlemap("columbia sc", scale=1, zoom=10))
library(ggmap)
mapImage <- ggmap(get_googlemap("columbia sc", scale=1, zoom=10))
mapImage <- ggmap(get_stamenmap("columbia sc", zoom=7))
?get_openstreetmap
help(package="ggmap")
gc <- geocode("columbia, sc")
mp <- get_map(gc)
columbia_bb <- bb2bbox(atr(mp,"bb"))
columbia_bb <- bb2bbox(attr(mp,"bb"))
mapImage <- ggmap(get_stamenmap(columbia_bb, scale=1,zoom=7))
states <- map_data("state")
ggplot2(aes(x=long,y=lat,group=group),data=states) + geom_polygon()
ggplot(aes(x=long,y=lat,group=group),data=states) + geom_polygon()
ggplot(aes(x=long,y=lat,group=group),data=states,color="white") + geom_polygon()
ggplot(aes(x=long,y=lat,group=group),data=states,color="white",fill="black") + geom_polygon()
?map_data
foo <- map_data("county",region="south.carolina")
ggplot(aes(x=long,y=lat,group=group),data=foo,color="white",fill="black") + geom_polygon()
acs.lookup(endyear=2015, span=5,dataset="acs", keyword= c("median","income","family","total"), case.sensitive=F)
library(acs)
api.key.install(key=api_key) # now you are ready to run the rest of the acs code
acs.lookup(endyear=2015, span=5,dataset="acs", keyword= c("median","income","family","total"), case.sensitive=F)
my_cnty <- geo.make(state = 45,county = "*")
home_median_price<-acs.fetch(geography=my_cnty, table.number="B19126",endyear=2015) # home median prices
head(home_median_price@estimate)
library(ggplot2)
sc_map <- map_data("county",region="south.carolina")
library(ggplot2)
sc_map <- map_data("county",region="south.carolina")
ggplot(aes(x=long,y=lat,group=group),data=foo,color="white",fill="black") + geom_polygon()
sc_map %>% View
library(ggplot2)
sc_map <- map_data("county",region="south.carolina")
ggplot(aes(x=long,y=lat,group=group),data=sc_map,colour="white",fill="black") + geom_polygon() + theme_nothing()
ggplot(aes(x=long,y=lat,group=group),data=sc_map,colour="white",fill="black") + geom_polygon() + theme_minimal()
ggplot() + geom_polygon(aes(x=long,y=lat,group=group),data=sc_map,colour="white",fill="black") + theme_minimal()
acs.lookup(endyear=2015, span=5,dataset="acs", keyword= c("median","income","family","total"), case.sensitive=F)
my_cnty <- geo.make(state = 45,county = "*")
home_median_price<-acs.fetch(geography=my_cnty, table.number="B19126",endyear=2015) # home median prices
kable::head(home_median_price@estimate)
kable(head(home_median_price@estimate))
knitr::kable(head(home_median_price@estimate))
home_median_price@estimate[1:5,]
merged <- home_median_price@estimate %>%
mutate(county = rownames(.)) %>%
select(county,B19126_001) %>%
rename(med_income=B19126_001)
merged <- as.data.frame(home_median_price@estimate) %>%
mutate(county = rownames(.)) %>%
select(county,B19126_001) %>%
rename(med_income=B19126_001)
library(dplyr)
merged <- as.data.frame(home_median_price@estimate) %>%
mutate(county = rownames(.)) %>%
select(county,B19126_001) %>%
rename(med_income=B19126_001)
merged
library(stringr)
?str_replace
merged <- as.data.frame(home_median_price@estimate) %>%
mutate(county_full = rownames(.),
county = str_replace(county_full,"(.+) County.*","\\1")) %>%
select(county,B19126_001) %>%
rename(med_income=B19126_001)
merged
merged <- as.data.frame(home_median_price@estimate) %>%
mutate(county_full = rownames(.),
county = str_replace(county_full,"(.+) County.*","\\1") %>% tolower) %>%
select(county,B19126_001) %>%
rename(med_income=B19126_001)
merged
map_data
sc_map[1:25,]
merged <- as.data.frame(home_median_price@estimate) %>%
mutate(county_full = rownames(.),
county = str_replace(county_full,"(.+) County.*","\\1") %>% tolower) %>%
select(county,B19126_001) %>%
rename(med_income=B19126_001) %>%
right_join(sc_map,by=c("county"="subregion"))
merged %>% View
library(dplyr)
library(stringr)
merged <- as.data.frame(home_median_price@estimate) %>%
mutate(county_full = rownames(.),
county = str_replace(county_full,"(.+) County.*","\\1") %>% tolower) %>%
select(county,B19126_001) %>%
rename(med_income=B19126_001) %>%
right_join(sc_map,by=c("county"="subregion"))
knitr::kable(head(merged,10))
ggplot() + geom_polygon(aes(x=long,y=lat,group=group),data=merged,colour=med_income,fill="black") + theme_minimal()
library(dplyr)
library(stringr)
merged <- as.data.frame(home_median_price@estimate) %>%
mutate(county_full = rownames(.),
county = str_replace(county_full,"(.+) County.*","\\1") %>% tolower) %>%
select(county,B19126_001) %>%
rename(med_income=B19126_001) %>%
right_join(sc_map,by=c("county"="subregion"))
knitr::kable(head(merged,10))
ggplot() + geom_polygon(aes(x=long,y=lat,group=group),data=merged,colour=med_income,fill="black") + theme_minimal()
ggplot() + geom_polygon(aes(x=long,y=lat,group=group,fill=med_income),data=merged,fill="black") + theme_minimal()
ggplot() + geom_polygon(aes(x=long,y=lat,group=group,fill=med_income),data=merged) + theme_minimal()
mp + geom_polygon(aes(x=long,y=lat,group=group,fill=med_income),data=merged) + theme_minimal()
installr::updater()
install.packages(c("XML","acs"))
install.packages("learnr")
install.packages(c("bookdown", "bookdownplus"))