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 / mario.R
Last active July 13, 2019 02:54
R implementation of CS50x's Problem Set 6 - mario, more comfortable
# mario.R
printCharInSeq <- function(char, num) {
for (n in seq_len(num)) {
cat(char)
}
}
prompt <- "Height: "
@BroVic
BroVic / adapt_eventBrite.R
Last active May 18, 2020 20:06
Trimming EventBrite data to suit local purpose
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 %>%
@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
# 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 / 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()
@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 / 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 / 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 / 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 / .gitignore
Last active August 11, 2022 23:24
Install gWidgets and gWidgetsRGtk2 archives
.Rhistory