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
# Create a vector of industry types with 10 elements | |
# This vector will be a character vector | |
industryType <- c("small", "medium", "small", "large", "large", "medium", "small", "small", "medium", "large") | |
industryType | |
length(industryType) | |
# Change it into a factor | |
industryCategory <- factor(industryType) | |
industryCategory |
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
# Receives as input a vector containing EPC strings and returns a data frame | |
# with each component of a string assigned to the appropriate column of the | |
# data frame, and the data frame will have as many rows as there are strings. | |
parseEPC <- function(epc) { | |
# internal functions | |
## Creates a regex anchor for the beginning of a string | |
rgxify <- function(x) { | |
stopifnot(exprs = { | |
is.character(x) | |
length(x) == 1L |
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 | |
Script to convert markdown file to word document | |
.DESCRIPTION | |
Convertes a markdown file into an word document using pandoc as converter. The process uses a word template file | |
.PARAMETER i | |
Specifies the input file. This is the markdown file | |
.PARAMETER o | |
Specifies the output file. This is the word document | |
.PARAMETER t |
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) { |
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
<# | |
.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
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 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
# 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
#include <string> | |
#include <iostream> | |
#include <map> | |
#include <utility> | |
using namespace std; | |
int solution(string s1, string s2) | |
{ |
NewerOlder