Realizar o ping em uma url deteminada e anotar o IP, tempo médio e máximo.
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(doParallel) | |
library(foreach) | |
my_data <- mtcars | |
# Within Sum of Squares | |
wss <- (nrow(my_data)-1)*sum(apply(my_data,2,var)) | |
# Number of clusters | |
try_clusters <- seq(from = 2, to = 8, by = 1) |
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(lubridate) | |
mother2 <- as.data.frame(list(month=c(2,2), day=c(28,30), year=c(1988, 1988))) | |
mother2$birth1 <- mapply(function(y, m, d){ | |
my_data <- paste0(as.character(y), | |
"-", as.character(m), | |
"-", as.character(d)) | |
ifelse(is.na(lubridate::ymd(my_data, quiet = TRUE)), NA, as.POSIXct(my_data, origin="1970-01-01")) | |
}, y = mother2$year, m = mother2$month, d = mother2$day) |
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
df <- data.frame( | |
id = c(1,1,2,2,2), | |
columnFields = c("column 1", "column 2", "column 1", "column 2", "column 3"), | |
valueFields = c(1:5)) | |
tidyr::spread(df, columnFields, valueFields) |
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(ggplot2) | |
library(tidyverse) | |
df <- mtcars %>% | |
gather(-mpg, key="var", value = "value") | |
ggplot(df, aes(x = value, y = mpg)) + | |
geom_point(alpha = 0.3) + | |
geom_smooth(method = "lm") + | |
facet_wrap(~var, scales = "free") + |
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(tidyverse) | |
files <- list.files(path = "./data/", pattern = "*.csv") | |
df <- files %>% | |
map(function(x) { | |
read.csv(paste0("./data/", x)) | |
}) %>% | |
reduce(rbind) | |
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(rvest) | |
#website | |
url <- ("http://www.anbima.com.br/est_termo/Curva_Zero.asp") | |
pgsession <- html_session(url) | |
pgform <-html_form(pgsession)[[1]] | |
fake_submit <- list("name" = NULL, | |
"type" = "submit", | |
"value" = "Submit", |
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
FROM rocker/tidyverse | |
RUN echo "deb http://ftp.debian.org/debian sid main" | tee -a /etc/apt/sources.list.d/sid.list | |
RUN apt-get update -qq && apt-get -y --no-install-recommends install \ | |
apt-transport-https \ | |
libssl-dev \ | |
libsasl2-dev \ | |
openssl \ | |
curl \ |
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) | |
texts <- c("Today I got to the movie", | |
"Yesterday we got to the movie", | |
"Today was cold at the movie", | |
"Somethign happened yesterday") | |
tok <- keras::text_tokenizer(num_words = 5) | |
keras::fit_text_tokenizer(tok, texts) |
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(foreach) | |
library(doParallel) | |
library(DBI) | |
#Creating the cluster | |
cl <- makeCluster(detectCores() -1) | |
# Defining packages and variables for cluster | |
clusterEvalQ(cl, { | |
library(odbc) |
OlderNewer