Skip to content

Commit

Permalink
adiciona materiais da main e curso passado
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrizmilz committed Mar 12, 2024
1 parent c3b9896 commit 3898e85
Show file tree
Hide file tree
Showing 57 changed files with 10,645 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Fora do horário de aula ou monitoria:
dplyr::select(Exemplo = url) |>
knitr::kable()
```

## Práticas

```{r}
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@ Fora do horário de aula ou monitoria:

## Slides

| Slide |
|:------|
| Slide |
|:----------------------------------------------------------------------------------------------------|
| [00_introducao.html](https://curso-r.github.io/202403-r4ds-2/slides/00_introducao.html) |
| [01_manipulacao.html](https://curso-r.github.io/202403-r4ds-2/slides/01_manipulacao.html) |
| [02_strings.html](https://curso-r.github.io/202403-r4ds-2/slides/02_strings.html) |
| [03_datas_fatores.html](https://curso-r.github.io/202403-r4ds-2/slides/03_datas_fatores.html) |
| [04_controle_funcoes.html](https://curso-r.github.io/202403-r4ds-2/slides/04_controle_funcoes.html) |
| [05_funcional.html](https://curso-r.github.io/202403-r4ds-2/slides/05_funcional.html) |
| [06_metaprogramacao.html](https://curso-r.github.io/202403-r4ds-2/slides/06_metaprogramacao.html) |

## Scripts utilizados em aula

Expand All @@ -44,8 +51,10 @@ Fora do horário de aula ou monitoria:

## Lição de casa

| Exercício |
|:----------|
| Exercício |
|:------------------------------------------------------------------------------|
| [tarefas.Rmd](https://curso-r.github.io/202403-r4ds-2/exercicios/tarefas.Rmd) |
| [tcc.Rmd](https://curso-r.github.io/202403-r4ds-2/exercicios/tcc.Rmd) |

## Material extra

Expand Down
172 changes: 172 additions & 0 deletions dados/imdb_2015.csv

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions dados/imdb_2016.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
titulo,ano,diretor,duracao,cor,generos,pais,classificacao,orcamento,receita,nota_imdb,likes_facebook,ator_1,ator_2,ator_3
Batman v Superman: Dawn of Justice,2016,Zack Snyder,183,Color,Action|Adventure|Sci-Fi,USA,A partir de 13 anos,250000000,330249062,6.9,197000,Henry Cavill,Lauren Cohan,Alan D. Purwin
Captain America: Civil War,2016,Anthony Russo,147,Color,Action|Adventure|Sci-Fi,USA,A partir de 13 anos,250000000,407197282,8.2,72000,Robert Downey Jr.,Scarlett Johansson,Chris Evans
Star Trek Beyond,2016,Justin Lin,122,Color,Action|Adventure|Sci-Fi|Thriller,USA,A partir de 13 anos,185000000,130468626,7.5,30000,Sofia Boutella,Melissa Roxburgh,Lydia Wilson
The Legend of Tarzan,2016,David Yates,110,Color,Action|Adventure|Drama|Romance,USA,A partir de 13 anos,180000000,124051759,6.6,29000,Christoph Waltz,Alexander Skarsgård,Casper Crump
X-Men: Apocalypse,2016,Bryan Singer,144,Color,Action|Adventure|Sci-Fi,USA,A partir de 13 anos,178000000,154985087,7.3,54000,Jennifer Lawrence,Michael Fassbender,Tye Sheridan
Suicide Squad,2016,David Ayer,123,Color,Action|Adventure|Comedy|Sci-Fi,USA,A partir de 13 anos,175000000,161087183,6.9,80000,Will Smith,Robin Atkin Downes,Ike Barinholtz
Independence Day: Resurgence,2016,Roland Emmerich,120,Color,Action|Adventure|Sci-Fi,USA,A partir de 13 anos,165000000,102315545,5.5,67000,Vivica A. Fox,Sela Ward,Judd Hirsch
Alice Through the Looking Glass,2016,James Bobin,113,Color,Adventure|Family|Fantasy,USA,Livre,170000000,76846624,6.4,30000,Johnny Depp,Alan Rickman,Anne Hathaway
Warcraft,2016,Duncan Jones,123,Color,Action|Adventure|Fantasy,USA,A partir de 13 anos,160000000,46978995,7.3,89000,Dominic Cooper,Callum Rennie,Ruth Negga
The Legend of Tarzan,2016,David Yates,110,Color,Action|Adventure|Drama|Romance,USA,A partir de 13 anos,180000000,124051759,6.6,29000,Christoph Waltz,Alexander Skarsgård,Casper Crump
Ghostbusters,2016,Paul Feig,116,Color,Action|Comedy|Fantasy|Sci-Fi,USA,A partir de 13 anos,144000000,118099659,5.5,62000,Ed Begley Jr.,Kate McKinnon,Zach Woods
Kung Fu Panda 3,2016,Alessandro Carloni,95,Color,Action|Adventure|Animation|Comedy|Family,USA,Livre,145000000,143523463,7.2,24000,J.K. Simmons,Angelina Jolie Pitt,Wayne Knight
Gods of Egypt,2016,Alex Proyas,126,Color,Action|Adventure|Fantasy,USA,A partir de 13 anos,140000000,31141074,5.5,24000,Gerard Butler,Elodie Yung,Bryan Brown
The Huntsman: Winter's War,2016,Cedric Nicolas-Troyan,120,Color,Action|Adventure|Drama|Fantasy,USA,A partir de 13 anos,115000000,47952020,6.1,16000,Chris Hemsworth,Sam Claflin,Charlize Theron
Teenage Mutant Ninja Turtles: Out of the Shadows,2016,Dave Green,112,Color,Action|Adventure|Comedy|Sci-Fi,USA,A partir de 13 anos,135000000,81638674,6.3,12000,Stephen Amell,Noel Fisher,Brad Garrett
Allegiant,2016,Robert Schwentke,120,Color,Action|Adventure|Mystery|Sci-Fi|Thriller,USA,A partir de 13 anos,110000000,66002193,5.8,12000,Naomi Watts,Theo James,Zoë Kravitz
Ben-Hur,2016,Timur Bekmambetov,141,Color,Adventure|Drama|History,USA,A partir de 13 anos,NA,NA,6.1,0,Morgan Freeman,Ayelet Zurer,Moises Arias
Now You See Me 2,2016,Jon M. Chu,129,Color,Action|Adventure|Comedy|Crime|Mystery|Thriller,USA,A partir de 13 anos,90000000,64685359,6.9,15000,Daniel Radcliffe,Morgan Freeman,Sanaa Lathan
The Angry Birds Movie,2016,Clay Kaytis,97,Color,Action|Animation|Comedy|Family,USA,Livre,73000000,107225164,6.3,14000,Peter Dinklage,Josh Gad,Keegan-Michael Key
The Finest Hours,2016,Craig Gillespie,117,Color,Action|Drama|History|Thriller,USA,A partir de 13 anos,NA,27550735,6.8,12000,Michael Raymond-James,Abraham Benrubi,Graham McTavish
Deadpool,2016,Tim Miller,108,Color,Action|Adventure|Comedy|Romance|Sci-Fi,USA,A partir de 18 anos,58000000,363024263,8.1,117000,Ryan Reynolds,Ed Skrein,Stefan Kapicic
Central Intelligence,2016,Rawson Marshall Thurber,107,Color,Action|Comedy|Crime,USA,A partir de 13 anos,50000000,126088877,6.6,10000,Dwayne Johnson,Thomas Kretschmann,Megan Park
13 Hours,2016,Michael Bay,144,Color,Action|Drama|Thriller|War,USA,A partir de 18 anos,50000000,52822418,7.4,44000,Toby Stephens,James Badge Dale,David Costabile
Free State of Jones,2016,Gary Ross,139,Color,Action|Biography|Drama|History|War,USA,A partir de 18 anos,50000000,20389967,6.7,10000,Matthew McConaughey,Donald Watkins,Jessica Collins
Zoolander 2,2016,Ben Stiller,102,Color,Comedy,USA,A partir de 13 anos,50000000,28837115,4.8,28000,Milla Jovovich,Will Ferrell,Justin Theroux
The Conjuring 2,2016,James Wan,134,Color,Horror|Mystery|Thriller,USA,A partir de 18 anos,40000000,102310175,7.8,40000,Javier Botet,Frances O'Connor,Robin Atkin Downes
Ride Along 2,2016,Tim Story,102,Color,Action|Comedy,USA,A partir de 13 anos,40000000,90835030,5.9,0,Olivia Munn,Nadine Velazquez,Bruce McGill
The 5th Wave,2016,J Blakeson,112,Color,Action|Adventure|Sci-Fi|Thriller,USA,A partir de 13 anos,38000000,34912982,5.2,14000,Chloë Grace Moretz,Maggie Siff,Nick Robinson
How to Be Single,2016,Christian Ditter,110,Color,Comedy|Romance,USA,A partir de 18 anos,38000000,46813366,6.1,15000,Alison Brie,Damon Wayans Jr.,Nicholas Braun
Neighbors 2: Sorority Rising,2016,Nicholas Stoller,92,Color,Comedy,USA,A partir de 18 anos,35000000,55291815,6,0,Chloë Grace Moretz,Ike Barinholtz,Kiersey Clemons
Ghostbusters,2016,Paul Feig,116,Color,Action|Comedy|Fantasy|Sci-Fi,USA,A partir de 13 anos,144000000,118099659,5.5,62000,Ed Begley Jr.,Kate McKinnon,Zach Woods
Sausage Party,2016,Greg Tiernan,89,Color,Adventure|Animation|Comedy|Fantasy,USA,A partir de 18 anos,19000000,NA,7.5,13000,James Franco,Salma Hayek,Anders Holm
The Boss,2016,Ben Falcone,99,Color,Comedy,USA,A partir de 18 anos,29000000,63034755,5.3,0,Peter Dinklage,Tyler Labine,Ben Falcone
Pride and Prejudice and Zombies,2016,Burr Steers,108,Color,Action|Horror|Romance,USA,A partir de 13 anos,28000000,10907291,5.8,73000,Matt Smith,Bella Heathcote,Sam Riley
Money Monster,2016,Jodie Foster,98,Color,Crime|Drama|Thriller,USA,A partir de 18 anos,27000000,41008532,6.7,0,Julia Roberts,Jack O'Connell,Chris Bauer
Jane Got a Gun,2016,Gavin O'Connor,98,Color,Action|Drama|Western,USA,A partir de 18 anos,25000000,1512815,5.8,0,Natalie Portman,Noah Emmerich,Boyd Holbrook
Bad Moms,2016,Jon Lucas,100,Color,Comedy,USA,A partir de 18 anos,20000000,55461307,6.7,18000,Mila Kunis,Jay Hernandez,Jada Pinkett Smith
Risen,2016,Kevin Reynolds,107,Color,Action|Adventure|Drama|Mystery,USA,A partir de 13 anos,20000000,36874745,6.3,21000,Peter Firth,Jan Cornet,María Botto
Nerve,2016,Henry Joost,96,Color,Adventure|Crime|Mystery|Sci-Fi|Thriller,USA,A partir de 13 anos,20000000,28876924,7.1,0,Samira Wiley,Marc John Jefferies,Emily Meade
Triple 9,2016,John Hillcoat,115,Color,Action|Crime|Drama|Thriller,USA,A partir de 18 anos,20000000,12626905,6.3,0,Kate Winslet,Norman Reedus,Clifton Collins Jr.
Fight Valley,2016,Rob Hawk,90,Color,Action|Drama,USA,Outros,27000000,NA,5,1000,Kari J. Kramer,Erin O'Brien,Cabrina Collesides
Indignation,2016,James Schamus,110,Color,Drama,USA,A partir de 18 anos,NA,560512,7.8,599,Logan Lerman,Sarah Gadon,Tracy Letts
My Big Fat Greek Wedding 2,2016,Kirk Jones,94,Color,Comedy|Family|Romance,USA,A partir de 13 anos,18000000,59573085,6.1,19000,Nia Vardalos,Louis Mandylor,Joey Fatone
Restoration,2016,Zack Ward,92,Color,Horror,USA,Outros,NA,NA,4,378,Zack Ward,Anna Harr,James Cullen Bressack
I Am Wrath,2016,Chuck Russell,92,Color,Action|Crime|Drama|Thriller,USA,A partir de 18 anos,18000000,NA,5.2,0,Sam Trammell,Rebecca De Mornay,Amanda Schull
The Young Messiah,2016,Cyrus Nowrasteh,111,Color,Drama,USA,A partir de 13 anos,18500000,6462576,5.4,0,Clive Russell,Vincent Walsh,Finn Ireland
Bad Moms,2016,Jon Lucas,100,Color,Comedy,USA,A partir de 18 anos,20000000,55461307,6.7,18000,Mila Kunis,Jay Hernandez,Jada Pinkett Smith
Ben-Hur,2016,Timur Bekmambetov,141,Color,Adventure|Drama|History,USA,A partir de 13 anos,100000000,NA,6.1,0,Morgan Freeman,Ayelet Zurer,Moises Arias
Keanu,2016,Peter Atencio,100,Color,Action|Comedy,USA,A partir de 18 anos,15000000,20566327,6.4,0,Nia Long,Will Forte,Keegan-Michael Key
Miracles from Heaven,2016,Patricia Riggen,109,Color,Drama,USA,Livre,13000000,61693523,6.8,16000,Jennifer Garner,Brighton Sharbino,Martin Henderson
The Shallows,2016,Jaume Collet-Serra,86,Color,Drama|Horror|Thriller,USA,A partir de 13 anos,17000000,54257433,6.8,0,Óscar Jaenada,Brett Cullen,Sedona Legge
Dirty Grandpa,2016,Dan Mazer,109,Color,Comedy,USA,A partir de 18 anos,11500000,35537564,6,11000,Robert De Niro,Zoey Deutch,Jason Mantzoukas
Misconduct,2016,Shintaro Shimosawa,106,Color,Drama|Thriller,USA,A partir de 18 anos,11000000,NA,5.3,0,Al Pacino,Anthony Hopkins,Glen Powell
The Boy,2016,William Brent Bell,97,Color,Horror|Mystery|Thriller,USA,A partir de 13 anos,10000000,35794166,6,20000,Lauren Cohan,Rupert Evans,Stephanie Lemelin
Pete's Dragon,2016,David Lowery,102,Color,Adventure|Family|Fantasy,USA,Livre,65000000,NA,7.3,21000,Bryce Dallas Howard,Oona Laurence,Isiah Whitlock Jr.
The Forest,2016,Jason Zada,93,Color,Horror|Mystery|Thriller,USA,A partir de 13 anos,10000000,26583369,4.8,10000,Eoin Macken,Stephanie Vogt,Gen Seto
Kicks,2016,Justin Tipping,80,Color,Adventure,USA,A partir de 18 anos,NA,NA,7.8,240,Tina Gilton,Natalie Stephany Aguilar,Justin Hall
Mr. Church,2016,Bruce Beresford,104,Color,Drama,USA,A partir de 13 anos,8000000,NA,8,205,Mckenna Grace,Lucy Fry,Natalie Coughlin
Code of Honor,2016,Michael Winnick,106,Color,Action,USA,A partir de 18 anos,8000000,NA,4.2,689,Scott Takeda,Helena Mattsson,Craig Sheffer
10 Cloverfield Lane,2016,Dan Trachtenberg,104,Color,Drama|Horror|Mystery|Sci-Fi|Thriller,USA,A partir de 13 anos,15000000,71897215,7.3,33000,Bradley Cooper,John Gallagher Jr.,Sumalee Montano
Lights Out,2016,David F. Sandberg,81,Color,Horror,USA,A partir de 13 anos,4900000,56536016,6.9,0,Billy Burke,Amiah Miller,Gabriel Bateman
Fifty Shades of Black,2016,Michael Tiddes,92,Color,Comedy,USA,A partir de 18 anos,5000000,11675178,3.5,11000,Fred Willard,Mike Epps,Russell Peters
The Perfect Match,2016,Bille Woodruff,96,Color,Comedy|Romance,USA,A partir de 18 anos,5000000,9658370,4.5,740,Donald Faison,Brandy Norwood,Lauren London
Yoga Hosers,2016,Kevin Smith,88,Color,Comedy|Fantasy|Horror|Thriller,USA,A partir de 13 anos,5000000,NA,4.8,0,Johnny Depp,Haley Joel Osment,Natasha Lyonne
The Veil,2016,Phil Joanou,93,Color,Horror,USA,A partir de 18 anos,4000000,NA,4.7,0,Lily Rabe,Shannon Woodward,Kira McLean
Ben-Hur,2016,Timur Bekmambetov,141,Color,Adventure|Drama|History,USA,A partir de 13 anos,100000000,NA,6,0,Morgan Freeman,Ayelet Zurer,Moises Arias
Antibirth,2016,Danny Perez,94,Color,Horror,USA,Outros,3500000,NA,6.3,89,Natasha Lyonne,Emmanuel Kabongo,Mark Webber
A Beginner's Guide to Snuff,2016,Mitchell Altieri,87,Color,Comedy|Horror|Thriller,USA,Outros,NA,NA,8.7,8,Kimberley Crossman,Luke Edwards,Bree Williamson
Cabin Fever,2016,Travis Zariwny,99,Color,Horror,USA,Outros,NA,NA,3.7,2000,Dustin Ingram,Gage Golightly,Samuel Davis
Kickboxer: Vengeance,2016,John Stockwell,90,NA,Action,USA,Outros,17000000,NA,9.1,0,Matthew Ziff,T.J. Storm,Sam Medina
The Dog Lover,2016,Alex Ranarivelo,101,Color,Drama,USA,Livre,2000000,NA,4.8,724,Lea Thompson,Christina Moore,Cullen Douglas
God's Not Dead 2,2016,Harold Cronk,120,Color,Drama,USA,Livre,5000000,20773070,3.4,0,Benjamin A. Onyango,Robin Givens,Maria Canals-Barrera
Fight to the Finish,2016,Warren Sheppard,94,Color,Action|Romance|Sport,USA,A partir de 13 anos,150000,NA,4,381,Jennifer Hale,Randy Jay Burrell,Vincent De Paul
Alleluia! The Devil's Carnival,2016,Darren Lynn Bousman,97,Color,Horror|Musical,USA,Outros,500000,NA,7.4,707,Paul Sorvino,Barry Bostwick,Terrance Zdunich
Rodeo Girl,2016,Joel Paul Reisig,108,Color,Family,USA,Livre,500000,NA,5.7,0,Carrie Bradstreet,Joel Paul Reisig,Yassie Hawkes
The Little Ponderosa Zoo,2016,Luke Dye,84,Color,Family,USA,Outros,500000,NA,5.2,9,Mike Stanley,Jeff Delaney,Jamison Stalsworth
The Birth of a Nation,2016,Nate Parker,120,Color,Biography|Drama,USA,A partir de 18 anos,10000000,NA,5.4,0,Jason Stuart,Nate Parker,Aunjanue Ellis
106 changes: 106 additions & 0 deletions exemplos/01_manipulacao.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Já carrega o tidyr e o dplyr
library(tidyverse)

# TIDYR -----------------------------------------------------------------------

# Tabelas que vamos usar
musicas <- select(billboard, track, wk1:wk6)
renda <- select(us_rent_income, NAME, variable, estimate)

musicas |>
pivot_longer(
cols = starts_with("wk"), # Colunas que começam com "wk"
names_to = "semana", # Nomes das colunas viram "semana"
values_to = "posicao" # Valores das colunas viram "posicao"
)

musicas |>
select(starts_with("wk"))

musicas |>
pivot_longer(
cols = starts_with("wk"),
names_to = semana, # Não funciona
values_to = posicao. # Não funciona
)

# DPLYR -----------------------------------------------------------------------

alunos <- tibble::tribble(
~Aluno, ~Nota1, ~Nota2, ~Nota3, ~Nota4, ~Nota5, ~Nota6, ~Nota7, ~Nota8, ~Nota9,
"Ana", "7.0", "1.6", "7.7", "3.9", "9.5", "10.0", "0.9", "7.9", "3.6",
"Bruno", "9.2", "1.5", "1.3", "5.1", "5.8", "7.1", "5.5", "8.7", "3.7",
"Caio", "5.7", "7.4", "1.9", "0.8", "2.3", "6.3", "3.3", "1.3", "1.5"
)

alunos

alunos |>
select(Nota1:Nota9)

alunos |>
select(starts_with("Nota"))

alunos |>
select(-Aluno)

alunos |>
select(2:10)

alunos |>
select(Nota1, Nota2, Nota3, Nota4, Nota5, Nota6, Nota7, Nota8, Nota9)

alunos |>
select(2, 3, 4, 5, 6, 7, 8, 9, 10)

alunos |>
select(-1)

alunos |>
mutate(across(c(Nota1, Nota2, Nota3), as.numeric))

alunos |>
select(c(Nota1, Nota2, Nota3))

estrelas <- select(starwars, 1:6)
estrelas

estrelas |>
select(where(is.character))

estrelas |>
select(where(is.numeric))

estrelas |>
select(-where(is.numeric))

is.character(estrelas$name)
is.numeric(estrelas$name)

estrelas |>
select(2:6, -mass)

estrelas |>
select(c(2:6, -mass))

mean(c(10, 10, NA))
mean(c(10, 10, NA), na.rm = TRUE)


mult_10 <- function(x) {
x * 10
}

alunos |>
mutate(
across(Nota1:Nota9, as.numeric),
across(Nota1:Nota9, mult_10)
)

c(1, 2, 3)
list(1, 2, 3)
list("um" = 1, "dois" = 2, "três" = 3)
list("media" = mean, "mediana" = median)

estrelas |>
unite("todas_as_cores", ends_with("color"), sep = "/")
Loading

0 comments on commit 3898e85

Please sign in to comment.