Learn R Programming

taRifx (version 1.0.6.2)

evens: Shortcut functions to return the odd and even values from a vector

Description

Takes an integer vector and returns every odd or even element

Usage

evens(vec)

Arguments

vec

Integer vector

Value

Returns an integer vector consisting of only the odd/even elements.

Examples

Run this code
# NOT RUN {
x <- as.integer(c(6,3,4,7,8,1047482,7))
evens(x)
odds(x)
# }

Run the code above in your browser using DataLab