Last active
March 24, 2021 22:17
-
-
Save beatrizmilz/50a683db77c1e6e216286bc60c12afa3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Código para realizar o sorteio! | |
# Carregar o pipe | |
library(magrittr, include.only = "%>%") | |
# Endereço da planilha gerada pelo Google Forms | |
url <- "https://docs.google.com/spreadsheets/d/1B4VPVsBsJYHVGlXJpKGs-p6fZj7pu-Vlnofpibg1RLc/edit?usp=sharing" | |
# Lê as respostas. | |
# Apenas quem tem acesso a este arquivo vai conseguir fazer essa etapa. | |
# É necessário autenticar! | |
respostas <- googlesheets4::read_sheet(url) | |
# Seleciona as 3 primeiras colunas, | |
# limpa os nomes, remove os NAs, | |
# e obtém apenas os valores distintos (evitar nomes repetidos) | |
nomes_participando <- respostas %>% | |
dplyr::select(1:3) %>% | |
janitor::clean_names() %>% | |
tidyr::drop_na(qual_e_o_seu_nome, qual_e_o_seu_email) %>% | |
dplyr::distinct(qual_e_o_seu_nome, qual_e_o_seu_email) | |
# Sorteia nomes! | |
nomes_participando %>% | |
dplyr::sample_n(2, replace = FALSE) | |
# Pessoas sorteadas: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment