View source: R/humdrumR-package.R
humdrumR | R Documentation |
humdrumR
is a toolkit for the analysis of data encoded in the humdrum syntax.
The humdrum syntax is an incredibly flexible, and powerful, scheme for encoding musical data.
Tens of thousands of musical scores (and other musical data) have been encoded in the humdrum syntax, many available online through repositories such as
KernScores.
The humdrumR
package is intended as a modernized replacement for the original humdrum toolkit, leveraging
the power of R
to give us unprecedented power to manipulate and analyze humdrum data using concise, expressive syntax.
humdrumRroot
is the path to where the humdrumR
package is install on your machine.
When you installed humdrumR
a few basic humdrum files were stored here as well,
in subdirectories examples
and HumdrumData
.
The humdrumR()
function is used to set
global package options within an R session, mostly regarding
the viewing of humdrumR datasets.
humdrumRroot
humdrumR(
view,
dataTypes,
maxRecordsPerFile,
maxTokenLength,
nullPrint,
syntaxHighlight,
censorEmptyRecords
)
view |
How should humdrumR data be printed? There are three options: Use |
dataTypes |
Which types of humdrum record(s) to view. Defaults to Must be a single |
maxRecordsPerFile |
How many records should be shown in each file, when more than one file is present? Defaults to Can be any positive whole number. |
maxTokenLength |
Length at which longer tokens are censored with ... Defaults to Can be any positive whole number. |
nullPrint |
How should null data points print? Default is Must be a single character string, partially matching |
syntaxHighlight |
Should syntax highlighting (coloring) be used in printout? Defaults to Must be a singleton logical value; an on/off switch. |
censorEmptyRecords |
Should consecutive records be "censored" (compressed) in printout? Defaults to Can be any positive whole number, up to |
An object of class character
of length 1.
The package humdrumR
has seven main components:
To represent humdrum data in R, we have the humdrumR S4 class, and it's core component the humdrum table.
To create humdrumR
data, a sophisticated humdrum data parser: readHumdrum.
humdrumR
data can also be written back to humdrum-syntax text files using writeHumdrum.
To filter humdrumR
data, we have the subset()/filter() functions, as well as methhods for
R
's standard indexing operators ([]
and [[]]
).
To manipulate and modify humdrumR
data, we have the with and within methods for humdrumR
objects, and tidyverse
aliases mutate()
, summarise()
, and reframe()
.
To facilitate the development of functions to work with humdrum tokens—which are simple character strings packed with information—, a useful API we call our regular-expression dispatch system.
Several modules for representing and manipulating musical pitch information, including our core tonalInterval class to represent tonal pitch.
A module for representing and manipulating musical rhythm information, with a core rhythmInterval class to represent rhythms.
The humdrumR()
function sets general options for the package,
mostly related to how humdrumR data objects are viewed.
Each argument to the function manipulates a print/package option: for any argument that is
not used, the option remains in its current setting (i.e., unchanged).
These package options are all enumerated and explained in the Arguments section above.
# change default view to table
humdrumR("table")
humdrumR(view = 'humdrum', maxRecordsPerFile = 50)
# see the humdrumR package directory contents
dir(humdrumRroot)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.