Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

stri_stats_general

General Statistics for a Character Vector


Description

This function gives general statistics for a character vector, e.g., obtained by loading a text file with the readLines or stri_read_lines function, where each text line' is represented by a separate string.

Usage

stri_stats_general(str)

Arguments

str

character vector to be aggregated

Details

None of the strings may contain \r or \n characters, otherwise you will get at error.

Below by 'white space' we mean the Unicode binary property WHITE_SPACE, see stringi-search-charclass.

Value

Returns an integer vector with the following named elements:

  1. Lines - number of lines (number of non-missing strings in the vector);

  2. LinesNEmpty - number of lines with at least one non-WHITE_SPACE character;

  3. Chars - total number of Unicode code points detected;

  4. CharsNWhite - number of Unicode code points that are not WHITE_SPACEs;

  5. ... (Other stuff that may appear in future releases of stringi).

See Also

Other stats: stri_stats_latex()

Examples

s <- c('Lorem ipsum dolor sit amet, consectetur adipisicing elit.',
       'nibh augue, suscipit a, scelerisque sed, lacinia in, mi.',
       'Cras vel lorem. Etiam pellentesque aliquet tellus.',
       '')
stri_stats_general(s)

stringi

Character String Processing Facilities

v1.6.1
file LICENSE
Authors
Marek Gagolewski [aut, cre, cph] (<https://orcid.org/0000-0003-0637-6028>), Bartek Tartanus [ctb], and others (stringi source code); IBM, Unicode, Inc. and others (ICU4C source code, Unicode Character Database)
Initial release
2021-05-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.