-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
502 lines (502 loc) · 13.5 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
knitr::opts_chunk$set(echo = TRUE)
library(kableExtra)
install.packages("kableExtra")
library(kableExtra)
kable(mtcars[1:5, ], "html") %>%
kable_styling("striped") %>%
row_spec(1, color = "red") %>%
save_kable("inst/test.pdf")
library(kableExtra)
kable(mtcars[1:5, ], "html") %>%
kable_styling("striped") %>%
row_spec(1, color = "red") %>%
save_kable("inst/test.pdf")
library(kableExtra)
kable(mtcars[1:5, ], "html") %>%
kable_styling("striped") %>%
row_spec(1, color = "red") %>%
save_kable("test.pdf")
kable(mtcars, "latex") %>%
kable_styling(latex_options = "striped") %>%
save_kable("test.png")
install.packages("magick")
install.packages("magick")
knitr::opts_chunk$set(echo = TRUE)
library(kableExtra)
kable(mtcars[1:5, ], "html") %>%
kable_styling("striped") %>%
row_spec(1, color = "red") %>%
save_kable("test.pdf")
kable(mtcars, "latex") %>%
kable_styling(latex_options = "striped") %>%
save_kable("test.png")
library(kableExtra)
kable(mtcars[1:5, ], "html") %>%
kable_styling("striped") %>%
row_spec(1, color = "red") %>%
save_kable("test.pdf")
#
# kable(mtcars, "latex") %>%
# kable_styling(latex_options = "striped") %>%
# save_kable("test.png")
library(kableExtra)
kable(mtcars[1:5, ], "html") %>%
kable_styling("striped") %>%
row_spec(1, color = "red") %>%
save_kable("test.pdf")
#
# kable(mtcars, "latex") %>%
# kable_styling(latex_options = "striped") %>%
# save_kable("test.png")
library(kableExtra)
kable(mtcars[1:5, ], "html") %>%
kable_styling("striped") %>%
row_spec(1, color = "red")
#
# kable(mtcars, "latex") %>%
# kable_styling(latex_options = "striped") %>%
# save_kable("test.png")
library(learnr)
install.packages("wordcloud")
install.packages("MASS")
library(ggplot2)
cars_table <- table(mtcars$mpg)
head(cars_table)
str(mtcars)
library(MASS)
str(MASS)
str(Cars93)
mfr_table <- table(Cars93$Manufacturer)
str(anscombe)
?anscombe
getwd()
getwd()
install.packages("xaringan")
# <font size="6">
#
# - Langage `R` Base ?
#
# - Le tidyverse ?
#
# </font>
# </div>
#
# </div>
install.packages("insuranceData")
# Load the insuranceData package
library(insuranceData)
# Use the data() function to load the dataCar data frame
data(dataCar)
# Load the tabplot package
suppressPackageStartupMessages(library(tabplot))
install.packages("tabplot")
# Load the tabplot package
suppressPackageStartupMessages(library(tabplot))
# Generate the default tableplot() display
tableplot(dataCar)
install.packages("tabplot")
install.packages("lattice")
getwd()
str(airquality)
library(lattice)
# Create scatterplot
xyplot(Ozone ~ Temp, data = airquality,
# Add main label
main = "Environmental conditions in New York City (1973)",
# Add axis labels
xlab = "Temperature (Fahrenheit)",
ylab = "Ozone (ppb)")
# Create scatterplot
xyplot(Ozone ~ Temp, data = airquality,
# Add main label
main = "Environmental conditions in New York City (1973)",
# Add axis labels
xlab = "Temperature (Fahrenheit)",
ylab = "Ozone (ppb)", abline = c(0,1))
# Create scatterplot
xyplot(Ozone ~ Temp, data = airquality,
# Add main label
main = "Environmental conditions in New York City (1973)",
# Add axis labels
xlab = "Temperature (Fahrenheit)",
ylab = "Ozone (ppb)", abline = c(1,0))
# Create scatterplot
xyplot(Ozone ~ Temp, data = airquality,
# Add main label
main = "Environmental conditions in New York City (1973)",
# Add axis labels
xlab = "Temperature (Fahrenheit)",
ylab = "Ozone (ppb)", abline = c(0,1))
?xyplot
# Create a density plot
densityplot(~ Ozone, data = airquality,
# Choose how raw data is shown
plot.points = FALSE)
# Create a density plot
densityplot(~ Ozone, data = airquality,
# Choose how raw data is shown
plot.points = T)
# Create a density plot
densityplot(~ Ozone, data = airquality,
# Choose how raw data is shown
plot.points = "jitter")
# 'USCancerRates' is pre-loaded
str(USCancerRates)
install.packages("latticeExtra")
library(lattice)
library(latticeExtra)
# USCancerRates has been pre-loaded
str(USCancerRates)
# Create a density plot
densityplot(~rate.male + rate.female,
data = USCancerRates,
# Set value of 'outer'
outer = FALSE,
# Add x-axis label
xlab = "Rate (per 100,000)",
# Add a legend
auto.key = TRUE,
plot.points = FALSE,
ref = TRUE)
# Create a density plot
densityplot(~rate.male + rate.female,
data = USCancerRates,
# Set value of 'outer'
outer = TRUE,
# Add x-axis label
xlab = "Rate (per 100,000)",
# Add a legend
auto.key = TRUE,
plot.points = FALSE,
ref = TRUE)
str(airquality)
xyplot(Ozone ~ Temp, airquality, groups = Month,
# Complete the legend spec
auto.key = list(space = "right",
title = "Month",
text = month.name[5:9]))
str(USCancerRates)
bwplot(state ~ rate.male + rate.female,
data = USCancerRates,
outer = TRUE,
# Add a label for the x-axis
xlab = "Rate (per 100,000)",
# Add strip labels
strip = strip.custom(c("Male","Female")))
library(ggplot2)
xyplot(Petal.Length ~ Petal.Width | Species, iris,
strip = strip.custom(style = 4))
xyplot(Petal.Length ~ Petal.Width | Species, iris,
strip = FALSE,
strip.left = strip.custom(style = 4, horizontal = FALSE))
str(mtcars)
install.packages("knitr")
install.packages("knitr")
library(latticeExtra)
knitr::opts_chunk$set(echo = FALSE)
library(htmltools)
library(dplyr)
library(tibble)
library(ggplot2)
library(plotly)
library(lattice)
library(latticeExtra)
options(tibble.print_max = 15)
options(tibble.print_min = 6)
tplot <- densityplot(~rate.male + rate.female,
data = USCancerRates, outer = T)
class(tplot)
str(USCancerRates)
tplot <- densityplot(~rate.male + rate.female | state,
data = USCancerRates, outer = T)
summary(tplot)[[]]
tplot <- densityplot(~rate.male + rate.female | state,
data = USCancerRates, outer = T)
summary(tplot)
summary(tplot)[[]]
tplot <- densityplot(~rate.male + rate.female | state,
data = USCancerRates, outer = T)
summary(tplot)
summary(tplot)[[2]]
tplot <- densityplot(~rate.male + rate.female | state,
data = USCancerRates, outer = T)
summary(tplot)[[2]]
tplot <- densityplot(~rate.male + rate.female | state,
data = USCancerRates, outer = T)
head(summary(tplot)[[2]])
plot(ChickWeight)
?ChickWeight
knitr::opts_chunk$set(echo = FALSE)
library(htmltools)
library(dplyr)
library(tibble)
library(ggplot2)
library(plotly)
library(lattice)
library(latticeExtra)
options(tibble.print_max = 15)
options(tibble.print_min = 6)
library(MASS)
plot(Boston$rad, Boston$tax, main ="Sunflowerplot")
library(MASS)
?Boston
Cars93
install.packages("corrplot")
library(ggplot2)
knitr::opts_chunk$set(echo = FALSE)
library(MASS)
library(htmltools)
library(dplyr)
library(tibble)
library(ggplot2)
library(plotly)
library(lattice)
library(latticeExtra)
options(tibble.print_max = 15)
options(tibble.print_min = 6)
correlation <- cor(mtcars)
correlation <- cor(mtcars)
library(corrplot)
corrplot(correlation,method = "ellipse")
correlation <- cor(mtcars)
library(corrplot)
corrplot(correlation,method = "ellipse")
knitr::opts_chunk$set(echo = TRUE)
library(corrplot)
library(ggplot2)
mat_cor <- cor(mtcars)
source('~/.active-rstudio-document', echo=TRUE)
chart_link
# Create a shareable link to your chart
# Set up API credentials: https://plot.ly/r/getting-started
chart_link = api_create(p, filename="scatter-modes")
tf <- tempfile(fileext = ".xlsx")
f <- download.file("https://www.impots.gouv.fr/portail/files/media/stats/isfcom2017.xlsx",tf)
table_test <- read_excel(tf, sheet = 2, skip = 1) %>%
arrange(desc(`nombre de redevables`))
library(dplyr)
table_test <- read_excel(tf, sheet = 2, skip = 1) %>%
arrange(desc(`nombre de redevables`))
library(readxl)
table_test <- read_excel(tf, sheet = 2, skip = 1) %>%
arrange(desc(`nombre de redevables`))
tf
table_test <- read_excel(f, sheet = 2, skip = 1) %>%
arrange(desc(`nombre de redevables`))
f
install.packages("mapview")
library(ggplot2)
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
library(plotly)
ggplot(mtcars)+
geom_point(aes(x=mpg,y=drv))
str(mtcars)
ggplot(mtcars)+
geom_point(aes(x=mpg,y=disp))
ggplot(mtcars)+
geom_point(aes(x=mpg,y=disp,color = factor(cyl)))
library(plotly)
p <- plot_ly(midwest, x = ~percollege, color = ~state, type = "box")
p
library(ggplot2)
par(mfrow = c(1,2))
plot(iris)
plot(iris, pch = 20, col = iris$Species)
plot(iris)
plot(iris, pch = 20, col = iris$Species)
par(mfrow = c(1,2))
par(mfrow = c(1,2))
plot(iris)
plot(iris, pch = 20, col = iris$Species)
par(mfrow = c(1,2))
plot(iris)
plot(iris, pch = 20, col = iris$Species)
old_options <- par(mfrow = c(2, 3))
plot(iris)
plot(iris, pch = 20, col = iris$Species)
par(old_options)
old_options <- par(mfrow = c(1, 2))
plot(iris)
plot(iris, pch = 20, col = iris$Species)
par(old_options)
old_options <- par(mfrow = c(1, 2))
plot(iris)
plot(mtcars)
par(old_options)
old_options <- par(mfrow = c(1, 2))
plot(iris$Sepal.Length,iris$Sepal.Width)
plot(mtcars$mpg,mtcars$disp)
par(old_options)
install.packages("corrr")
install.packages("corrr")
library("rmarkdown", lib.loc="~/R/win-library/3.5")
install.packages("Rcpp")
install.packages("Rcpp")
install.packages("ggplot2")
install.packages("corrplot")
install.packages("corrr")
library(ggplot2)
library(corrr)
library(dplyr)
mtcars %>%
correlate() %>%
focus(mpg:drat, mirror = TRUE) %>%
network_plot()
sessionInfo()
install.packages(c("corrr", "dplyr", "ggplot2", "plotly"))
install.packages("knitr")
# install.packages("remotes")
remotes::install_github("Thinkr-open/golem")
install.packages("remotes")
# install.packages("remotes")
remotes::install_github("Thinkr-open/golem")
install.packages("rstudioapi")
install.packages("learnr")
install.packages("corrplot")
install.packages("latticeExtra")
install.packages("rwhatsapp")
library(ggplot2)
plot(mtcars)
plot(mtcars, col = "blue")
hist(mtcars$wt)
hist(mtcars$wt, col = "gray")
object <- density(mtcars$wt)
plot(object)
hist(mtcars$wt)
line(object)
hist(mtcars$wt)
line(object)
hist(mtcars$wt)
lines(object)
y <- rnorm(100)
histogram(y, type="density",
panel=function(...){
panel.histogram(...)
panel.mathdensity(dmath = dnorm, args = list(mean=mean(y), sd=sd(y)),
n = 250, identifier = "mathdensity", col="red", lwd=2)
}
)
library(lattice)
y <- rnorm(100)
histogram(y, type="density",
panel=function(...){
panel.histogram(...)
panel.mathdensity(dmath = dnorm, args = list(mean=mean(y), sd=sd(y)),
n = 250, identifier = "mathdensity", col="red", lwd=2)
}
)
table(mtcars$drv)
barplot(table(mtcars$drv))
str(mtcars)
barplot(table(mtcars$carb))
install.packages("trellisjscope")
shiny::runApp('demo')
library(latticeExtra)
str(USCancerRates)
head(USCancerRates)
vu <- data("USCancerRates")
vu <- data(USCancerRates)
vu <- data(USCancerRates)
plot(vu)
data(USCancerRates)
force(USCancerRates)
str(USCancerRates)
xyplot(rate.female~rate.male, data = USCancerRates
grid = TRUE, abline(lm(rate.female~rate.male, data = USCancerRates)))
xyplot(rate.female~rate.male, data = USCancerRates,
grid = TRUE, abline(lm(rate.female~rate.male, data = USCancerRates)))
xyplot(rate.female~rate.male, data = USCancerRates,
grid = TRUE, abline(lm(rate.female~rate.male, data = USCancerRates)))
lm(rate.female~rate.male, data = USCancerRates)
a <- lm(rate.female~rate.male, data = USCancerRates)
xyplot(rate.female~rate.male, data = USCancerRates,
grid = TRUE, abline(a[2],a[1]))
a[1]
a$coefficients[2]
xyplot(rate.female~rate.male, data = USCancerRates,
grid = TRUE, abline(a$coefficients[2],a$coefficients[1]))
xyplot(rate.female~rate.male, data = USCancerRates,
grid = TRUE, abline(a$coefficients[1],a$coefficients[2]))
xyplot(rate.female~rate.male, data = USCancerRates,
)
# Use the 'airquality' dataset
str(airquality)
# Create the histogram
histogram(~ Ozone, data = airquality,
# Specify number of bins
nint = 15,
# Specify quantity displayed on y-axis
type = "count")
# Create the histogram
histogram(~ Ozone, data = airquality,
# Specify number of bins
nint = 15,
# Specify quantity displayed on y-axis
type = "density")
# Create a density plot
densityplot(~ Ozone, data = airquality,
# Choose how raw data is shown
plot.points = "jitter")
bwplot(state~rate.male, data = USCancerRates)
library(dplyr)
USCancerRates <- mutate(USCancerRates,
states_ordered =
reorder(state,rate.male, na.rm = T))
bwplot(state_ordered~rate.male, data = USCancerRates)
bwplot(states_ordered~rate.male, data = USCancerRates)
library(lattice)
data(USCancerRates, package = "latticeExtra")
xyplot(rate.female~rate.male|state, USCancerRates,
grid = T, abline = c(0,1))
histogram(~rate.female + rate.male,USCancerRates,
layout = c(1,2))
histogram(~rate.female + rate.male,USCancerRates,outer = T,
layout = c(1,2))
histogram(~rate.female + rate.male,USCancerRates,outer = F,
layout = c(1,2))
histogram(~rate.female + rate.male,USCancerRates,outer = T,
layout = c(1,2))
knitr::opts_chunk$set(echo = FALSE)
library(corrplot)
library(MASS)
library(htmltools)
library(dplyr)
library(tibble)
library(ggplot2)
library(plotly)
library(lattice)
library(latticeExtra)
# library(mlmRev)
options(tibble.print_max = 15)
options(tibble.print_min = 6)
data(USCancerRates, package = "latticeExtra")
log.r.m <- log(USCancerRates$rate.male)
hist(log.r.m, freq = F)
lines(density(log.r.m,na.rm = T))
data(USCancerRates, package = "latticeExtra")
log.r.m <- log(USCancerRates$rate.male)
hist(log.r.m, freq = F)
lines(density(log.r.m,na.rm = T), col = "green")
panel.histdens <- function(x, ...){
panel.histogram(...)
panel.lines(density(x,na.rm = T))
}
histogram(~rate.female + rate.male, USCancerRates,
type = "density", layout = c(1,2),
panel = panel.histdens)
panel.histdens <- function(x, ...){
panel.histogram(x,...)
panel.lines(density(x,na.rm = T))
}
histogram(~rate.female + rate.male, USCancerRates,
type = "density", layout = c(1,2),
panel = panel.histdens)
panel.histdens <- function(x, ...){
panel.histogram(x,...)
panel.lines(density(x,na.rm = T))
}
histogram(~rate.female + rate.male, USCancerRates,
type = "density", layout = c(1,2),
scale = list(x = list(log = T, equispaced.log = F)),
panel = panel.histdens)