str_sort: Sort a Vector of Strings

Description Usage Arguments Examples

View source: R/str_sort.R

Description

Sorts a vector of strings lexically, as based on their UTF-8 ordering scheme. Lower-case letters are, by default, 'larger' than upper-case letters. This function will safely sort a UTF-8 vector.

Usage

1
str_sort(x, increasing = TRUE, ignore.case = FALSE, USE.NAMES = FALSE)

Arguments

x

a character vector (a vector of 'strings' to sort)

increasing

boolean. sort the string in increasing lexical order?

ignore.case

boolean. ignore case (so that, eg, a < A < b)

USE.NAMES

logical. if names attribute already exists on x, pass this through to the result?

Examples

1
stopifnot( all( str_sort(c("cba", "fed")) == c("abc", "def") ) )

Kmisc documentation built on May 29, 2017, 1:43 p.m.

Related to str_sort in Kmisc...