This file contains hidden or 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
| diamond.query('carat > 3.5 and color=="J") |
This file contains hidden or 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
| # Install the Benchmarking package if you haven't already | |
| # install.packages("Benchmarking") | |
| # Load the library | |
| library(Benchmarking) | |
| # Sample data: inputs (x) and outputs (y) for a set of DMUs | |
| # Example from the package documentation | |
| x <- matrix(c(100, 200, 300, 500, 100, 200, 600), ncol = 1) | |
| y <- matrix(c(75, 100, 300, 400, 25, 50, 400), ncol = 1) |
This file contains hidden or 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
| link = 'https://github.com/DATAUNIRIO/dados_para_aula/raw/refs/heads/main/csv/Titanic.csv' | |
| link2 ='https://github.com/DATAUNIRIO/dados_para_aula/raw/refs/heads/main/csv/students.csv' | |
| titanic = read.delim2(link,sep = ";") | |
| estudantes = read.csv(link2) | |
| table(estudantes$Sex,estudantes$Major) | |
| library(forcats) | |
| estudantes$Novo_Major = fct_lump(estudantes$Major, n = 3) |
This file contains hidden or 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
| iconv(Titanic$Classe, "latin1", "UTF-8") | |
| library(stringi) | |
| # Seu texto com problema | |
| texto <- "Tripula\xe7\xe3o" | |
| # Converter escapes Unicode para caracteres | |
| texto_corrigido <- stri_unescape_unicode(gsub("\\\\x", "\\\\u00", texto)) |
This file contains hidden or 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
| # https://rfortherestofus.com/2024/01/speedometer | |
| library(tidyverse) | |
| library(ggplot2) | |
| #Metas Alcançadas | |
| #7.84% das metas estão alcançadas | |
| percentage_done = 0.078 | |
| percentual_feito = scales::comma(percentage_done, accuracy = 0.001, big.mark = "." , decimal.mark = ",") |
This file contains hidden or 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
| # Importando as bibliotecas do python | |
| import pandas as pd | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| familias = pd.read_excel("https://github.com/DATAUNIRIO/dados_para_aula/raw/refs/heads/main/excel/Familias.xls") | |
| familias.head() | |
| def dotplot(input_x, **args): |
This file contains hidden or 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
| snippet meu_save_no_excel_formatado | |
| library(openxlsx) | |
| #options("openxlsx.borderColour" = "#003747") | |
| #options("openxlsx.borderStyle" = "thin") | |
| #options("openxlsx.dateFormat" = "%d %b %Y") | |
| estilo_cabecalho <- createStyle(fgFill="#003747",fontColour="#ffffff",halign="center", border = "TopBottomLeftRight",fontSize=16,textDecoration = "Bold") | |
| wb <- createWorkbook() | |
| modifyBaseFont(wb, fontSize = 13, fontName = "Arial Narrow") |
This file contains hidden or 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
| # https://stats.oarc.ucla.edu/other/mult-pkg/faq/general/faq-how-do-i-interpret-odds-ratios-in-logistic-regression/ | |
| dados = matrix(c(74, 17, 77, 32), ncol = 2) | |
| dados | |
| dimnames(dados) <- list(voto = c("Normal","Menção Honrosa"), | |
| sexo = c("Masculino","Feminino")) | |
| dados | |
| mosaicplot(dados, color = c("skyblue", "pink"), xlab ="Menção Honrosa", | |
| ylab = "Sexo") |
This file contains hidden or 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
| tibble::tibble() | |
| tribunais <- forosCNJ::da_tribunal |> | |
| dplyr::filter(id_justica == 8) |> | |
| dplyr::pull(sigla) |> | |
| tolower() | |
| endpoints <- glue::glue( | |
| "https://api-publica.datajud.cnj.jus.br/api_publica_{tribunais}/_search" | |
| ) |
This file contains hidden or 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
| library(dplyr) | |
| percentual <- CARROS %>% | |
| pull(TipodeMarcha) %>% | |
| table() %>% | |
| prop.table()*100 | |
| percentual <- round(percentual,digits = 1) | |
| rotulo <- paste0(percentual,"%") | |
| #GRÁFICO DE BARRA | |
| bp<- CARROS %>% | |
| pull(TipodeMarcha) %>% |
NewerOlder