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
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers']) | |
.run(function(DB) { | |
DB.init(); | |
}); |
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
a = b = c = d = e = f = g = h = i = j = pi | |
save.image(choose.files()) |
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
vet_logical = c(T, T, F, F) | |
vet_int = 11:14 | |
vet_numeric = c(1.0, 2.0, 3.0, 4.0) | |
vet_text = letters[1:4] | |
vet_imaginary = c((1 + 1i), (1 + 1i), (1 + 1i), (1 + 1i)) | |
my_list = list(vet_logico, vet_int, vet_numerico, vet_texto, vet_imaginario) | |
my_matrix = matrix(seq(from=2, by=2, length.out = 16), nrow = 4) |
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
# Special Values | |
na = NA | |
nan = NaN | |
infinity = Inf | |
less_inifinity = -Inf | |
null = NULL | |
my_vector = c(na, nan, infinity, less_inifinity, null) |
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
# Create a sequence | |
my_seq = seq(from = 1, by = 5, length.out = 30) | |
# Crete a sequence with the another list size | |
along = seq_along(my_seq) |
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
install.packages('lubridate') | |
library(lubridate) | |
nextBlackFriday = function(year){ | |
first_november = ymd(paste(year,"1101")) | |
day_of_week = wday(first_november, label = TRUE) | |
shift = ifelse(as.numeric(day_of_week) < 6, 0, 7) | |
next_friday = first_november + days(6 - as.numeric(day_of_week) + shift) | |
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
# Composistion | |
def f(x): | |
return x + 2 | |
def g(h, x): | |
return h(x) * 2 | |
print(g(f, 42)) | |
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
# Vector operations | |
a = c(333135, 19890804, 894, 478618, 2112) | |
b = a * 2 | |
c = b / 3 | |
d = c + a^2 | |
e = sqrt(d) | |
# Reverse matrix | |
ai = rev(a) |
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
# Generates random numbers uniformly | |
histogram(runif(1:100000)) | |
# Probabily of one numbe given a unifom random numbers | |
dunif(x= 8, min= 1, max=11) | |
# Samples | |
set.seed(1) | |
amostra = c("T","R","I", "A", "N", "G", "U", "L", "O") | |
sample(x = amostra, replace = FALSE) |
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
download = function(f){ | |
if(!file.exists('data')){ | |
dir.create('data') | |
} | |
file.local = file.path('./data', basename(f)) | |
if(!file.exists(file.local)){ | |
download.file(url = f, destfile = file.local , mode='wb') | |
} |
OlderNewer