nchars: Count the number of characters

ncharsR Documentation

Count the number of characters

Description

Count the number of characters

Usage

nchars(x, ...)

## S4 method for signature 'partition'
nchars(
  x,
  p_attribute = "word",
  regexCharsToKeep = "[a-zA-Z]",
  toLower = TRUE,
  decreasing = TRUE
)

## S4 method for signature 'subcorpus'
nchars(
  x,
  p_attribute = "word",
  regexCharsToKeep = "[a-zA-Z]",
  toLower = TRUE,
  decreasing = TRUE
)

## S4 method for signature 'partition_bundle'
nchars(x, mc = FALSE, progress = TRUE, decreasing = TRUE, ...)

## S4 method for signature 'subcorpus_bundle'
nchars(x, decreasing = TRUE, mc = FALSE, progress = TRUE, ...)

## S4 method for signature 'corpus'
nchars(
  x,
  p_attribute = "word",
  toLower = TRUE,
  sample = 5000000L,
  regexCharsToKeep = "[a-zA-Z]",
  decreasing = TRUE,
  mc = FALSE,
  progress = TRUE
)

Arguments

x

Object to process.

...

Argument passed into blapply().

p_attribute

the p-attribute

regexCharsToKeep

if NULL, counts for all charactrs will be returned, else a regex indicating which characters to include in the counting

toLower

whether to lower tokens

decreasing

logical, passed into order call

mc

logical

progress

A logical value.

sample

An integer or numeric value defining the number of sample tokens extracted from the (entirely decoded) token stream to be evaluated.

Examples

library(polmineR)
use("RcppCWB")

partition("REUTERS", id = "127") %>%
  nchars()
  
corpus("REUTERS") %>%
  subset(id == "127") %>%
  nchars()
  
corpus("REUTERS") %>%
  partition_bundle(s_attribute = "id") %>%
  nchars()
  
corpus("REUTERS") %>%
  split(s_attribute = "id") %>%
  nchars()
library(polmineR)
use("RcppCWB")
n <- corpus("REUTERS") %>% nchars(sample = 4000)

PolMine/polmineR.misc documentation built on Nov. 23, 2022, 9:01 p.m.