suppressPackageStartupMessages({ library(minilocate) }) knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" ) set.seed(1)
The goal of minilocate is to provide a way to search for a vector within another vector i.e. to find a needle in a haystack.
As far as I know, there's no base function for finding one sequence inside another sequence.
The core code was originally written by Jonathan Carroll in a response to this post.
I've adapted the code to suit my needs:
bit
class from the bit
package.You can install minilocate from github with:
# install.packages("devtools") devtools::install_github("coolbutuseless/minilocate")
locate(c('m', 'n'), letters) locate(c(0, 0, 1), sample(c(0, 1), 100, replace=TRUE)) locate(c(T, F, F), c(T, F, F, T, F, T, F, F)) locate(as.raw(10:11), 1:100) locate(c('5', '6'), 1:10) locate(c(0, 1), c(0, 0, 1, 0, 0, 1), alignment = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.