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
##################### | |
# # | |
# Lists # | |
# # | |
##################### | |
# Note that the function arguments used in this sample script are rather verbose | |
# just to enhance your understanding. You DO NOT always need to specify arguments. | |
## We MAY first of all create components: |
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
# Why 'glue' and not 'paste' or 'sprintf' | |
# adapting the example | |
library(microbenchmark) | |
library(glue) | |
name <- "Fred" | |
age <- 30 | |
anniversary <- as.Date('1991-10-12') |
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
## -- Makefile -- ## | |
## | |
## MIT License | |
## | |
## Copyright (c) 2019 Victor Ordu | |
## | |
## -------------- ## | |
ROOTDIR = ./ | |
DWNDIR = $(ROOTDIR)downloads/ |
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
# Inspired by https://www.ecdc.europa.eu/en/publications-data/download-todays-data-geographic-distribution-covid-19-cases-worldwide | |
# System requirements: Recent version of R e.g. R-3.6.x (www.r-project.org) | |
# | |
# Running the script: | |
# 1. From the command line: Navigate to directory where script is saved and | |
# there run this command: | |
# Rscript covid-ecdc.R | |
# | |
# 2. From the R console: Call the `source()` function using the relative or |
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
# titanic.R | |
## An R Script on simple exploration of the Titanic dataset | |
## In RGui, to run an R script's line hold CTRL + R | |
## Download the dataset into the working directory | |
# Check the working directory, | |
getwd() |
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(here) | |
suppressPackageStartupMessages(library(dplyr)) | |
ourDir <- file.path(here(), "events/StatesmanSeries/data") | |
ebriteCsv <- file.path(ourDir, "SOGP_Eventbrite Reg.csv") | |
eBrite <- read.csv(ebriteCsv, stringsAsFactors = FALSE) | |
vars <- colnames(eBrite) | |
dat <- eBrite %>% |
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
# comp-check1.R | |
library(tidyverse) | |
library(MASS) | |
library(caret) | |
set.seed(1) | |
Sigma <- 9 * matrix(c(1, 0.5, 0.5, 1), 2, 2) | |
dat <- mvrnorm(n = 100, c(69, 69), Sigma = Sigma) %>% | |
data.frame() %>% |
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-pssqlite.ps1 | |
# Copyright (c) 2018 Victor Ordu. All rights reserved. | |
# See LICENSE for details. | |
Write-Verbose "Checking for avaiablity of PSSQLite Module" | |
# Check if SQLite is (properly) installed | |
if(-not $ENV:Path.Contains('sqlite')) { | |
Write-Error "'sqlite3' does not exist or is not on system PATH." |
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
# Socket connections | |
# Client side | |
# http://blog.corynissen.com/2013/05/using-r-to-communicate-via-socket.html | |
client <- function(){ | |
while (TRUE) { | |
con <- socketConnection(host = "localhost", port = 6011, blocking = TRUE, | |
server = FALSE, open = "r+") | |
f <- file("stdin") | |
open(f) |
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(dslabs) | |
library(dplyr) | |
library(lubridate) | |
library(caret) | |
data("reported_heights") | |
dat <- | |
mutate(reported_heights, date_time = ymd_hms(time_stamp)) %>% | |
filter(date_time >= make_date(2016, 01, 25) & |