-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaula05.R
94 lines (80 loc) · 2.02 KB
/
aula05.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
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
require(tidyverse)
require(magrittr)
require(data.table)
files = system("ls archive", intern = TRUE)
filmes = list()
for(i in 1:length(files)){
nome = gsub(x = files[i],
pattern = ".csv",
replacement = "")
filmes[[i]] <- fread(paste0("/home/est/absm24/CE302/CE302_2024/archive/", files[i])) %>%
mutate(tipo = nome)
filmes[[i]]$year %<>% as.integer()
filmes[[i]]$`gross(in $)` %<>% as.numeric()
}
filmes %<>% bind_rows()
filmes %>%
ggplot() +
aes( x = year,
y = `gross(in $)`,
color = tipo) + ## Adicionamos cor
geom_point()
filmes %>%
ggplot() +
aes( x = year,
y = `gross(in $)`,
color = tipo) +
geom_point() +
theme_minimal() ## Incluímos tema
filmes %>%
ggplot() +
aes( x = year,
y = `gross(in $)`,
color = tipo) +
geom_point() +
facet_wrap(vars(tipo)) + ## Fazemos o gráfico separado por tipo
theme_minimal()
filmes %>%
filter(tipo %in% "animation") %>%
ggplot() +
aes( x = year,
y = `gross(in $)`,
color = tipo,
size = rating) +
geom_point() +
theme_minimal()
filmes %>%
filter(tipo %in% "animation") %>%
ggplot() +
aes( x = year,
y = `gross(in $)`,
color = tipo,
size = rating) +
geom_point() +
scale_size_continuous(range=c(0.01, 2)) +
theme_minimal()
filmes %>%
filter(tipo %in% "animation") %>%
ggplot() +
aes( x = year,
y = `gross(in $)`,
color = tipo,
size = rating) +
geom_point() +
scale_size_continuous(range=c(0.01, 2)) +
labs(x = "Ano",
y = "Investimento ($)") +
theme_minimal()
filmes %>%
filter(tipo %in% "animation") %>%
ggplot() +
aes( x = year,
y = `gross(in $)`,
color = tipo,
fill = tipo) +
geom_point() +
geom_smooth(method = "loess") + # O método aqui se refere ao método utilizado para estimação da curva
scale_size_continuous(range=c(0.01, 2)) +
labs(x = "Ano",
y = "Investimento ($)") +
theme_minimal()