Skip to content

Instantly share code, notes, and snippets.

View sergiospagnuolo's full-sized avatar
🐕‍🦺

Sérgio Spagnuolo sergiospagnuolo

🐕‍🦺
View GitHub Profile
@fernandobarbalho
fernandobarbalho / get_cofog_data.r
Created July 14, 2021 15:02
Extração de dados do cofog diretamente da base de dados abertos do Tesouro Transparente
library(readxl)
library(ckanr)
library(purrr)
ckanr::package_search()
package<- ckanr::package_show(id= "22d13d17-bf69-4a1a-add2-25cc1e25f2d7",
url= "https://www.tesourotransparente.gov.br/ckan") #busca todos os dados do dataset que se refere aos dados de COFOG
@benmarwick
benmarwick / PDF-2-text-or-CSV.r
Last active July 18, 2022 03:48
Convert PDFs to text files or CSV files (DfR format) with R
# Here are a few methods for getting text from PDF files. Do read through
# the instructions carefully! NOte that this code is written for Windows 7,
# slight adjustments may be needed for other OSs
# Tell R what folder contains your 1000s of PDFs
dest <- "G:/somehere/with/many/PDFs"
# make a vector of PDF file names
myfiles <- list.files(path = dest, pattern = "pdf", full.names = TRUE)
@fernandobarbalho
fernandobarbalho / gist:40f7e6c0cf925065e21084062e5ad513
Last active August 9, 2022 20:55
script para leitura e tratamento de tabela do ibama sobre oleamento de praias do NE
library(tabulizer)
library(dplyr)
setwd("~/GitHub/oleogate/data")
#Extrai tabelas do arquivo pdf.
#Esse arquivo foi baixado do seguinte link
# https://politica.estadao.com.br/blogs/estadao-verifica/wp-content/uploads/sites/690/2019/10/Ibama.pdf
#A tabela é extraída para um arquivo csv de forma a poder trabalhar melhor questões de encoding
tabulizer::extract_tables("ibama.pdf", output = "csv",outdir = getwd())
@lgelape
lgelape / stopwords_pt.R
Last active March 7, 2023 18:45
Create a dataset with stopwords in Portuguese (from Stopwords ISO, tidytext and tm packages)
### STOPWORDS IN PORTUGUESE
## Create a unique dataset from several datasets with stopwords in Portuguese
# Lucas Gelape
# Packages
library(dplyr)
library(stringi)
library(readr)
@jlomako
jlomako / openai_in_R.R
Created October 27, 2022 15:34
use GPT-3 in R with the OpenAI API
#####################################################
# Use GPT-3 in R with the OpenAI API. You need to install the reticulate package.
# Additionally, an API key is required that must be saved in a separate file, called .openaikey
# Get your API key here: https://openai.com/api/
#####################################################
# install.packages("reticulate") # run only once
library(reticulate)
# create python env
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@letanure
letanure / estados-cidades.json
Last active April 30, 2024 23:07
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@yanofsky
yanofsky / LICENSE
Last active May 4, 2024 08:45
A script to download all of a user's tweets into a csv
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit