This file contains 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
require(httr) | |
require(XML) | |
require(ggplot2) | |
# dados de IDH por estado americano do Wikipedia | |
resp <- GET("http://en.wikipedia.org/wiki/List_of_U.S._states_by_American_Human_Development_Index") | |
html <- htmlParse(content(resp, as="text")) | |
htmlTable <- readHTMLTable(html, header = TRUE, stringsAsFactors = FALSE) | |
# IDH |
This file contains 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(glmnet) | |
X = model.matrix(rchp ~ 1 | |
+ jogo_do_brasil*(competicao | |
+ jogo_do_brasil | |
+ fase2 | |
+ jogo_do_n1 | |
+ jogo_da_italia | |
+ I(log(soma_ranking)) | |
+ I(log(produto_ranking)) |
This file contains 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
--- | |
title: "Exemplo Tabelas com Pander em RMarkdown" | |
author: "Athos" | |
date: "Wednesday, November 05, 2014" | |
output: html_document | |
--- | |
```{r} | |
library(pander) | |
library(magrittr) |
This file contains 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(shiny) | |
library(magrittr) | |
shinyServer(function(input, output, session) { | |
#__________________________________________________________________________________ | |
# The main named list that will be used in many other tasks. | |
listN <- reactiveValues() | |
#__________________________________________________________________________________ |
This file contains 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
# matriz de betas! | |
library(ggplot2) | |
library(dplyr) | |
# parâmetros da beta | |
a <- b <- c(0.1,0.5,1,2,3) | |
# pontos pra fazer a linha | |
x <- seq(0, 1, len = 100) |
This file contains 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(keras) | |
library(dplyr) | |
logit <- function(p) log(p) - log(1 - p) | |
inv_logit <- function(x) 1/(1 + exp(-x)) | |
n <- 10000 | |
set.seed(19880923) | |
df <- data.frame(x = rnorm(n)) %>% | |
mutate(y_1 = rbinom(n, 1, prob = inv_logit(-1 + 4 * x)) %>% as.factor, |
This file contains 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(stats) | |
library(tidyverse) | |
library(httr) | |
library(jsonlite) | |
library(telegram) | |
## Create the bot object | |
bot <- TGBot$new(token = bot_token('AthosDamianiBot')) | |
bot$getMe() |
This file contains 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(readr) | |
library(stringr) | |
library(tidyr) | |
library(dplyr) | |
library(purrr) | |
library(tokenizers) | |
library(forcats) | |
reviews <- read_lines("finefoods.txt.gz") | |
reviews <- reviews[str_sub(reviews, 1, 12) == "review/text:"] |
This file contains 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
--------------------------------------------------------------------------- | |
ImportError Traceback (most recent call last) | |
~\Anaconda3\envs\athos\lib\site-packages\numpy\core\__init__.py in <module> | |
15 try: | |
---> 16 from . import multiarray | |
17 except ImportError as exc: | |
~\Anaconda3\envs\athos\lib\site-packages\numpy\core\multiarray.py in <module> | |
11 | |
---> 12 from . import overrides |
This file contains 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(RSQLite) | |
library(tidyverse) | |
library(dbplyr) | |
con <- RSQLite::dbConnect(RSQLite::SQLite(), "database.sqlite") | |
nome_das_tabelas <- RSQLite::dbListTables(con) | |
tabelas <- nome_das_tabelas %>% | |
map(~dbplyr::db_collect(con, glue::glue("select * from {.x}"))) %>% |
OlderNewer