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
# Source file: rcmd.ps1 | |
# | |
# A PowerShell script for batch execution of R specifically | |
# for the naijR project | |
# TODO: Affirm script execution policy | |
[CmdletBinding()] | |
PARAM ( |
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
/*** | |
* Given a sequence of integers as an array, | |
* determine whether it is possible to obtain | |
* a strictly increasing sequence by removing | |
* no more than one element from the array. | |
* | |
* Note: sequence a0, a1, ..., an is considered | |
* to be a strictly increasing if | |
* a0 < a1 < ... < an. Sequence containing | |
* only one element is also considered to be |
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
/** | |
After becoming famous, the CodeBots decided to move into a new | |
uilding together. Each of the rooms has a different cost, and | |
ome of them are free, but there's a rumour that all the free | |
ooms are haunted! Since the CodeBots are quite superstitious, | |
hey refuse to stay in any of the free rooms, or any of the | |
ooms below any of the free rooms. | |
Given matrix, a rectangular matrix of integers, where each | |
alue represents the cost of the room, your task is to return |
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
#include <string> | |
#include <iostream> | |
#include <map> | |
#include <utility> | |
using namespace std; | |
int solution(string s1, string s2) | |
{ |
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-r-suite.ps1 | |
# (c) 2021-2022 Victor Ordu / DevSolutions Ltd. All rights reserved. | |
<# | |
.SYNOPSIS | |
A PowerShell script to enable the download and installation of R 4.1.3, R Studio and Rtools40. | |
.DESCRIPTION | |
This script will do the following: | |
1. Check whether R is installed on the system already. |
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
<# | |
.SYNOPSIS | |
Control various actions to be taken on the RQDAassist repository/package. | |
.DESCRIPTION | |
The RQDAassist package repository in more complicated that some regular CRAN-compatible packages. | |
For instance, the RQDA packages and its dependencies have to be regularly cleaned up for tests | |
to be carried out on both binary and source installation options. Also, at this point, the package | |
is only working with R versions lower than 4.2. So when developing, one has to always remember to | |
use that version, when it's not the one pointed to by PATH. This script makes it easy to carry out |
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
euler <- function(x) (1 + 1/x)^x | |
n <- c(1:10, 100, 1e3, 1e6, 1e9) | |
euler(n) |
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
<# | |
.SYNOPSIS | |
Control various actions to be taken on the RQDAassist repository/package. | |
.DESCRIPTION | |
The RQDAassist package repository is more complicated than some regular CRAN-compatible packages. | |
For instance, the RQDA packages and its dependencies have to be regularly cleaned up for testing | |
out both binary and source installation options. Also, at this point, the package | |
is only working with R versions lower than 4.2. So when developing, one has to always remember to | |
use that version, when it's not the one pointed to by PATH. This script makes it easy to carry out |
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(sf) | |
library(tmap) | |
# The output of `map_ng` is of class `map` is convertible | |
# to an object of class `sf` | |
ng_map <- naijR::map_ng(plot = FALSE) | |
ng_sf <- st_as_sfc(ng_map) | |
tm_shape(ng_sf) + | |
tm_polygons() |
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
(m = matrix(1:10, nrow = 5, byrow = TRUE)) | |
m[[2]] | |
m[[7]] | |
m[[10]] <- 11L | |
rbind(m, c(11,12)) | |
# Add names | |
i <- 0L | |
dimnames(m) <- lapply(c("x", "y"), function(d) { |