Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Victor Ordu BroVic

🎯
Focusing
View GitHub Profile
View list-functions.R
# install.packages('xlsx')
library(dplyr)
vals <- sapply(ls(pos = "package:dplyr"), function(x) {
if (is.function(get(x)))
return(TRUE)
FALSE
})
funcs <- vals[vals]
@BroVic
BroVic / geopol.R
Last active Jun 18, 2021
Sample Code for Drawing Geo-political Zones
View geopol.R
library(naijR)
# 1. Draw plot of North-East GPZ
# First, get the states of interest
# Then, pass them to the mapping function's `region` parameter
ne <- states(gpz = "ne")
map_ng(
region = ne,
title = "North-East Geopolitical Zone",
fill = TRUE,
View penta.R
library(readxl)
library(tidyr)
# My Path. Use yours
path <-
"~/Documents/5-Personal/Data/DATA DHIS MONTHLY RI TEMPLATE 5.xlsx"
riData <- read_xlsx(path = path)
riData <- riData[-c(2:3),]
hdr <- unname(unlist(riData[1,]))
View example-interview.txt
Interview Transcript
(Source: http://www.u.arizona.edu/~kimmehea/purdue/421/exampleinterview.htm)
Interviewer: Student
Interviewee: Associate Head of Mechanical Engineering
Interview Setting: Interview conducted in office of [professor's] office in the mechanical engineering building. The interview was conducted at 3:30 PM on Wednesday afternoon.
Affiliation with interviewee: Professor has been my professor for two classes. I have also spoken with him privately regarding attending graduate school and areas of study.
@BroVic
BroVic / arise-720.R
Last active May 27, 2021
Script for reviewing project 720 registrations
View arise-720.R
# 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 Aug 11, 2020
Implementing client-server connection in R
View client.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 Mar 11, 2021
Install gWidgets and gWidgetsRGtk2 archives
@BroVic
BroVic / install-pssqlite.ps1
Created Jun 19, 2020
A PowerShell script for installing the PSSQLite Module
View install-pssqlite.ps1
# 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 Apr 22, 2020
A simple R script for displaying daily COVID-19 reporting by countries
View covid-ecdc.R
# 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 Mar 16, 2020
Why would I want to use glue instead of base functions for string interpolation?
View why-glue.R
# Why 'glue' and not 'paste' or 'sprintf'
# adapting the example
library(microbenchmark)
library(glue)
name <- "Fred"
age <- 30
anniversary <- as.Date('1991-10-12')