text_to_chars {ds4psy}R Documentation

Split string(s) of text x into its characters.

Description

text_to_chars splits a string of text x (consisting of one or more character strings) into a vector of its individual characters.

Usage

text_to_chars(x, rm_specials = FALSE, sep = "")

Arguments

x

A string of text (required).

rm_specials

Boolean: Remove special characters? Default: rm_specials = TRUE.

sep

Character to insert between the elements of a multi-element character vector as input x? Default: sep = "" (i.e., add nothing).

Details

If rm_specials = TRUE, most special (or non-word) characters are removed. (Note that this currently works without using regular expressions.)

text_to_chars is an inverse function of chars_to_text.

Value

A character vector (containing individual characters).

See Also

chars_to_text for combining character vectors into text; text_to_sentences for splitting text into a vector of sentences; text_to_words for splitting text into a vector of words; count_chars for counting the frequency of characters; count_words for counting the frequency of words; strsplit for splitting strings.

Other text objects and functions: Umlaut, capitalize(), caseflip(), cclass, chars_to_text(), collapse_chars(), count_chars_words(), count_chars(), count_words(), invert_rules(), l33t_rul35, map_text_chars(), map_text_coord(), map_text_regex(), metachar, read_ascii(), text_to_sentences(), text_to_words(), transl33t(), words_to_text()

Examples

s3 <- c("A 1st sentence.", "The 2nd sentence.",
        "A 3rd --- and  FINAL --- sentence.")
text_to_chars(s3)
text_to_chars(s3, sep = "\n")
text_to_chars(s3, rm_specials = TRUE) 


[Package ds4psy version 1.0.0 Index]