Skip to content

Instantly share code, notes, and snippets.

View DATAUNIRIO's full-sized avatar

DATAUNIRIO DATAUNIRIO

View GitHub Profile
@DATAUNIRIO
DATAUNIRIO / server.R
Created October 20, 2018 22:32 — forked from withr/server.R
Encrypt password with md5 for Shiny-app.
library(shiny)
library(datasets)
Logged = FALSE;
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad")
# Define server logic required to summarize and view the selected dataset
shinyServer(function(input, output) {
source("www/Login.R", local = TRUE)
observe({
if (USER$Logged == TRUE) {
Estados<-data.frame(uf=c('AC', 'AL', 'AM', 'AP', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA',
'MG', 'MS', 'MT', 'PA', 'PB', 'PE', 'PI', 'PR', 'RJ', 'RN',
'RO', 'RR','RS', 'SC', 'SE', 'SP', 'TO'),
regiao=c('Norte','Nordeste','Norte','Norte','Nordeste','Nordeste','Centro-Oeste',
'Sudeste','Centro-Oeste','Nordeste','Sudeste','Centro-Oeste','Centro-Oeste','Norte',
'Nordeste','Nordeste','Nordeste','Sul','Sudeste','Nordeste','Norte',
'Norte','Sul','Sul','Nordeste','Sudeste','Norte'),
cod_ibge =c(12,27,13,16,29,23,53,32,52,21,31,50,51,15,25,26,22,41,33,24,11,
14,43,42,28,35,17)
)
`%!in%` = Negate(`%in%`)
library(robotstxt)
paths_allowed("https://bsi.uniriotec.br/obrigatorias/")
# Robots.txt says okay to scrape
library(rvest)
page <- read_html("https://bsi.uniriotec.br/obrigatorias/")
obrigatorias<- page %>% html_nodes("a") %>%
html_attr("href")
obrigatorias<-obrigatorias[65:99]
#-------------------------------------------------------------------------------------------
# Versão 2 - modificado em 01/05/2021
#-------------------------------------------------------------------------------------------
library(readr)
suicide <- read_csv("github/Base_de_dados/suicide.csv")
names(suicide)
# Pegar o rotulo
library(rworldmap)
@DATAUNIRIO
DATAUNIRIO / gist:f96f3dd50d894368f9b5762d18955690
Created April 29, 2021 17:56
Para download no R para SER
for (i in numeroEntidade) {
url <- paste0(Parte1,i,Parte2)
local2<-paste0(local,i,".xls")
Sys.sleep(3)
##Download the file
download.file(url, local2, mode="wb")
print(i)
}
@DATAUNIRIO
DATAUNIRIO / indice_absenteismo.R
Last active May 8, 2021 18:00
Criação de Índice de Absenteísmo
#-------------------------------------------------------------------------------------------
# Versão 1 - modificado em 08/05/2021 (Thayanne Pinheiro)
#-------------------------------------------------------------------------------------------
# Carregar as bibliotecas
library(janitor)
library(readxl)
library(dplyr)
# Carregar a base de dados e limpar o nome da variavel
@DATAUNIRIO
DATAUNIRIO / mapas com geobr e geom_sf.R
Last active August 29, 2021 14:23
Mapas com geobr e geom_sf
library(readxl)
library(dplyr)
library(ggplot2)
# Import -----------------------------------------------------------------------
dados_brutos <- read_excel("C:/Users/Hp/Desktop/Base_de_dados-master/BasesEstados.xlsx")
mapa_estados <- geobr::read_state()
#plot(mapa_estados)
# Tidy -------------------------------------------------------------------------
@DATAUNIRIO
DATAUNIRIO / funcionamento_do_reactable.R
Last active July 10, 2021 17:56
funcionamento do reactable e flextable
# -----------------------------------------------------------------------
# reactable
# -----------------------------------------------------------------------
library(reactable)
library(reactablefmtr)
library(dplyr)
library(flextable)
#library(sparkline)