Skip to content

Instantly share code, notes, and snippets.

View beatrizmilz's full-sized avatar

Beatriz Milz beatrizmilz

View GitHub Profile
# Funcao para 1 dia -------------------------
buscar_dados_votacao <- function(data) {
# url da API
base <-
"https://legis.senado.leg.br/dadosabertos/plenario/lista/votacao/"
json <- jsonlite::fromJSON(paste0(base, data))
dados <- json |>
purrr::pluck("ListaVotacoes") |>
@beatrizmilz
beatrizmilz / twitch.R
Last active December 8, 2021 12:42
Código em R para buscar vídeos de um canal na twitch
# AUTENTICAR NA TWITCH VIA R --------------------------------------------
# O que está na documentação:
# GET https://id.twitch.tv/oauth2/authorize
# ?client_id=<your client ID>
# &redirect_uri=<your registered redirect URI>
# &response_type=<type>
# &scope=<space-separated list of scopes>
# Adaptando isso para o que precisamos...
#' Author: Bea
#' Subject: Tidytuesday de 20 de abril de 2021
library(magrittr, include.only = "%>%")
library(ggplot2)
# Import ----------------------------------------------------------------------
netflix <-
readr::read_csv(
'https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-04-20/netflix_titles.csv'
#' Copy templates from packages
#'
#' @param path Character: a path where the files will be copied
#' @param pacote name of the package that contains the template
#' @param template name of the template: thesis, resume, poster-relaxed,
#' poster-jacobs, card ...
#' @return
#' @export
#'
#' @examples get_templates_packages("template/", "pagedreport", "windmill")
# 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!
#' Author: Beatriz Milz
#' Subject: Gráfico do volume armazenado no Sistema Cantareira. Dados da sabesp,
#' disponíveis no pacote mananciais.
library(readr)
library(ggplot2)
library(magrittr)
# Import -----------------------------------------------------------------------