parity_functions: Even/Odd (Parity) Functions

Description Usage Arguments Value Note Examples

Description

Extract even/odd characters via odd_char/even_char. Extract even/odd elements of an R objects (vector or list) via even_obj/odd_obj

Usage

1
2
3
4
5
6
7

Arguments

x

A character vector for even_char/odd_char or a R list/vector for even_obj/odd_obj.

Value

the even or odd elements of the input, in vector format for odd_char/even_char, and the format remains consistent with the input for even_obj/odd_obj.

Note

convenience functions only. even_char/odd_char perhaps could be more efficient.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# ExAMPLE 1
odd_char(paste(letters[1:26], collapse = ""))

# EXAMPLE 2
even_char("a1b2c3d4")

# EXAMPLE 3
ex_list <-
 list(a1 = "warthog", b2 = "bomber",
 c3 = "PO", c4 = "explosives are dangerous")
odd_obj(ex_list)
even_obj(ex_list)

JamesDalrymple/wccmh documentation built on May 7, 2019, 10:20 a.m.