detect_seq: Detects if a certain sequence is present in a matrix.

Description Usage Arguments Examples

View source: R/xy2index.R

Description

This function allows for the detection of a particular sequence in a matrix.

Usage

1

Arguments

data

A matrix.

sequence

The desired sequence to search for.

reps

Number of repetitions of the sequence.

diag

Do you want to search diagonals? Defaults to TRUE.

Examples

1
2
3
4
M = matrix(sample(c(1,2),25,replace=TRUE),5,5)
detect_seq(data = M, sequence = "2", reps = 5)
#or equivalently
detect_seq(data = M, sequence = "22222", reps = 1)

BoardGames documentation built on May 2, 2019, 3:45 a.m.