Skip to content

Instantly share code, notes, and snippets.

View BroVic's full-sized avatar
🎯
Focusing

Victor Ordu BroVic

🎯
Focusing
View GitHub Profile
@BroVic
BroVic / arise-720.R
Last active May 27, 2021 08:09
Script for reviewing project 720 registrations
# To run this script on computer with R installed:
# Open the command line in the folder where the script is saved.
# Make sure it is saved as "arise-720-reg.csv" (Overwrite any old version of the file)
# At the prompt, run:
#
# Rscript arise-720-reg.csv
#
# If run for the first time, an internet connection may be rerquired to download required packages.
#
tidypack <- "tidyverse"
@BroVic
BroVic / client.R
Last active August 11, 2020 01:34
Implementing client-server connection in R
# 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)
@BroVic
BroVic / .gitignore
Last active August 11, 2022 23:24
Install gWidgets and gWidgetsRGtk2 archives
.Rhistory
@BroVic
BroVic / install-pssqlite.ps1
Created June 19, 2020 15:22
A PowerShell script for installing the PSSQLite Module
# 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."
@BroVic
BroVic / covid-ecdc.R
Last active April 22, 2020 23:26
A simple R script for displaying daily COVID-19 reporting by countries
# 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
@BroVic
BroVic / why-glue.R
Created March 16, 2020 12:45
Why would I want to use glue instead of base functions for string interpolation?
# Why 'glue' and not 'paste' or 'sprintf'
# adapting the example
library(microbenchmark)
library(glue)
name <- "Fred"
age <- 30
anniversary <- as.Date('1991-10-12')
@BroVic
BroVic / Makefile
Last active March 18, 2020 13:57
A Makefile for cleaning and transforming data, generating HTML codebooks and building MS Word reports
## -- Makefile -- ##
##
## MIT License
##
## Copyright (c) 2019 Victor Ordu
##
## -------------- ##
ROOTDIR = ./
DWNDIR = $(ROOTDIR)downloads/
@BroVic
BroVic / setup.R
Last active August 22, 2019 15:16
Setting up for Arise Nigeria Conference
if (!requireNamespace("remotes"))
install.packages("remotes", repos = "https://cran.rstudio.com")
remotes::install_github("DevSolutionsLtd/AriseNg/ariseng")
library(ariseng)
fetch_settings()
fetch_dependencies()
DataEntry::DataEntry()
# 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()
@BroVic
BroVic / excel_to_posix_date.ps1
Created July 30, 2019 08:12
When Excel messes up your CSVs
# Converting Date Entries in a CSV file back to POSIX style (after being mucked up by MS Excel)
# Note: The first column is for Dates
Param(
[string]$file,
[switch]$Detailed
)
$tempfile = New-TemporaryFile