Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Victor Ordu BroVic

🎯
Focusing
View GitHub Profile
View ma.R
# Intuition of the MA model based on https://www.youtube.com/watch?v=voryLhxiPzE
dat <- data.frame(f.hat = NA, epsilon = c(-2, 1, 0, 2, 1), f = NA)
mu <- 10
phi <- .5
for (i in seq(nrow(dat))) {
if (i == 1L)
dat$f.hat[i] <- mu
@BroVic
BroVic / install-rqda.R
Last active May 9, 2022
Script for installing RQDA
View install-rqda.R
install.packages("remotes")
remotes::install_github("BroVic/RQDAassist", ref = "apple")
RQDAassist::install()
@BroVic
BroVic / main.cpp
Created Jan 30, 2022
MaxCounter [Codility Lesson in C++]
View main.cpp
#include <vector>
#include <numeric>
#include <unordered_map>
#include <algorithm>
#include <iostream>
std::vector<int> solution(int N, std::vector<int> &A) {
// write your code in C++14 (g++ 6.2.0)
// for each element of the list
// if the element at the position is same as `max` i.e. it doesn't exist in monitor
@BroVic
BroVic / tables-blog-2.R
Last active Nov 10, 2021
Pre-load data for blog post
View tables-blog-2.R
if (getRversion() < 4.1)
stop("R version 4.1 or greater is required", call. = FALSE)
dat <- mtcars
levs <-
structure(
.Data = list(c("V-shaped", "straight"), c("automatic", "manual")),
names = fcols <- c('vs', 'am')
)
for (i in fcols)
dat[[i]] <- (dat[[i]] == 0) |>
@BroVic
BroVic / mod-mtcars.R
Last active Nov 8, 2021
A modification of the builtin mtcars dataset that converts a couple of variables to factors
View mod-mtcars.R
stopifnot(getRversion() >= 4.1)
dat <- mtcars
levs <-
structure(
.Data = list(c("V-shaped", "straight"), c("automatic", "manual")),
names = fcols <- c('vs', 'am')
)
for (i in fcols)
dat[[i]] <- (dat[[i]] == 0) |>
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"