-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
58 lines (41 loc) · 1.37 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# nseq
<!-- badges: start -->
[![R-CMD-check](https://github.com/rfsaldanha/nseq/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rfsaldanha/nseq/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/nseq)](https://CRAN.R-project.org/package=nseq)
<!-- badges: end -->
Compute the number of sequences of values in a vector that meets conditions of length and magnitude.
## Installation
You can install the stable release from CRAN.
``` r
install.packages("nseq")
library(nseq)
```
Or install the development version of from GitHub:
``` r
# install.packages("remotes")
remotes::install_github("rfsaldanha/nseq")
library(nseq)
```
## Example
On this vector, how many sequences of values present at least 3 consecutive observations with values equal or greater than 5?
```{r example}
library(nseq)
vec <- c(8,15,20,8,1,7,8,0,-2,5,9,12,0,-1,4,2,3,1)
trle_cond(vec, a_op = "gte", a = 3, b_op = "gte", b = 5)
```
And how many sequences of values have exactly 3 consecutive observations with values equal or greater than 5?
```{r}
trle_cond(vec, a_op = "e", a = 3, b_op = "gte", b = 5)
```