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) {
`%!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]
@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)
}
#-------------------------------------------------------------------------------------------
# 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 / 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 / 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)
@DATAUNIRIO
DATAUNIRIO / Graficos de Barras de Faixas de Custo.R
Last active July 30, 2021 21:04
Graficos de Barras de Faixas de custo - KGBLAND
library(readxl)
Stardew_Valley <- read_excel("C:/Users/KGBLAND/endereco_do_arquivo/Stardew_Valley.xlsx")
head(Stardew_Valley)
names(Stardew_Valley)
# Essa variável é quantitativa
table(Stardew_Valley$Custo_na_Cidade)
# Transformando em variavel quantitativa
Stardew_Valley$Custo_na_Cidade<-as.numeric(Stardew_Valley$Custo_na_Cidade)
#--------------------------------------------------------------------
# codigo para baixar dados do site
#--------------------------------------------------------------------
url_do_rds <- "https://github.com/DATAUNIRIO/Base_de_dados/raw/master/basometro.RDS"
url_do_rds <- "https://github.com/DATAUNIRIO/Base_de_dados/raw/master/CARROS.RData"
url_do_rds <- "https://github.com/DATAUNIRIO/Base_de_dados/raw/master/BasesEstados.xlsx"
#download.file(url,"basometro.RDS",method="curl") # linux
download.file(url_do_rds,"basometro.RDS",mode="wb") # windows