between: Do values in a numeric vector fall in specified range?

Description Usage Arguments Examples

View source: R/RcppExports.R

Description

This is a shortcut for x >= left & x <= right, implemented efficiently in C++ for local values, and translated to the appropriate SQL for remote tables.

Usage

1
between(x, left, right)

Arguments

x

A numeric vector of values

left, right

Boundary values

Examples

1
2
x <- rnorm(1e2)
x[between(x, -1, 1)]

Example output

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

 [1] -0.220476239 -0.519631631  0.521694538 -0.155626341  0.736318792
 [6] -0.797958810  0.443410304  0.480643653 -0.421373527 -0.064163915
[11] -0.584032658 -0.114099542 -0.620240113  0.574690156 -0.213292855
[16]  0.312938023 -0.746778321 -0.230240698  0.919043235  0.982906682
[21]  0.316591518  0.081154564 -0.542680120  0.288255644  0.848067262
[26]  0.353617941  0.671323474 -0.589782022  0.455586441 -0.387671147
[31]  0.415039190 -0.643265423  0.340774518 -0.802112463  0.109924576
[36]  0.992300481 -0.658132387 -0.783891803 -0.368878584 -0.145038136
[41] -0.838874878 -0.274586669  0.122402053 -0.125549868 -0.172400750
[46] -0.702722445  0.981064908  0.113853135 -0.652134479  0.654932183
[51]  0.396552573 -0.600204338  0.380973616 -0.844824099  0.001428283
[56] -0.653591654 -0.879155515  0.225276416 -0.523487108 -0.771733862
[61] -0.616006764 -0.301885979  0.289494308  0.711042995  0.242761202
[66]  0.749296668  0.094800139 -0.770754857

dplyr documentation built on Nov. 10, 2018, 9:04 a.m.