census | R Documentation |
census
tabulates the raw "size" of a humdrumR corpus,
including the total number of records and tokens.
census
is one of humdrumR's
basic corpus summary functions.
census(
humdrumR,
dataTypes = "GLIMDd",
by = Piece,
removeEmpty = FALSE,
drop = FALSE
)
census(humdata)[i]
## S3 method for class 'humCensus'
print(censusTable, showEach = TRUE, screenWidth = options("width")$width - 10L)
humdrumR |
HumdrumR data. Must be a humdrumR data object. |
dataTypes |
Which types of humdrum records to include in the census. Defaults to Must be |
by |
An arbitrary expression which indicates how to group the data. Defaults to |
removeEmpty |
Whether to include zero tokens. Defaults to Must be a singleton If set |
drop |
Whether to return normal data.table or a Defaults to Must be a singleton If |
i |
Index for rows. If |
census
returns a special data.frame
called a humCensus
table.
A humCensus
table has five columns of information:
Records
The total number of records.
Tokens
The total number of tokens.
(unique)
The number of unique tokens
Characters
The total number of characters.
(This includes humdrum control characters like *
and !!
.)
(per token)
This is simply Characters / Tokens
, indicating the mean length of each token.
By default, census
tabulates data within pieces in the corpus,
with each piece tabulated in a row of the humCensus
table.
Rows are labeled with each file name.
When a humCensus
object is printed,
the totals across all pieces are printed as well—(unique) and (per token)
values are calculated across all pieces as well, not summed.
The by
argument can be used to tabulate data across other divisions in the data (see next section).
The by
argument to census
indicates groupings in the data to tabulate within, grouping
across pieces in the corpus by default.
by
can be an arbitrary expression which is evaluated inside the humdrum table,
like the groupby
argument to a with/within call.
The by expression must be the full length of the humdrum table.
Other corpus summary functions:
humSummary
,
interpretations()
,
reference()
,
spines()
chorales <- readHumdrum(humdrumRroot, "HumdrumData/BachChorales/*.krn")
census(chorales)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.