thin: Thin a vector

View source: R/hacks.R

thinR Documentation

Thin a vector

Description

Take every (say) fifth element from a vector (like a list of filenames, keeping the first and final ones.

Usage

thin(x, jump_size = NULL, n = NULL, neg = FALSE)

Arguments

x

the vector to be thinned

jump_size

pick every 'jump_size'th element

n

pick (roughly) length elements, ie set 'jumps = length(x) / n.'

neg

Return the elements picked (default behaviour) or the complement (ie all the other elements).

Details

If you've got 200 frames for a video and want to thin it to around 40, then use this.

Examples

thin(1:19, jump = 5)
thin(1:20, n = 6)

bbcuffer/rcutils documentation built on Nov. 10, 2023, 12:08 p.m.