Skip to content

Commit

Permalink
Finalized 7.0.3. Tests passing. Site built. News updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncondits3 committed Dec 28, 2023
2 parents 96f9c84 + bf0136f commit cfc5a7c
Show file tree
Hide file tree
Showing 319 changed files with 5,691 additions and 6,300 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: humdrumR
Title: humdrumR
Version: 0.7.0.2
Version: 0.7.0.3
Authors@R: c(person("Nathaniel", "Condit-Schultz", email = "[email protected]", role = c("aut", "cre")),
person("Claire", "Arthur", email = "[email protected]", role = "aut"))
Description: This package is a toolkit for the visualization, manipulation, and analysis of data encoded in the Humdrum syntax (<http://www.humdrum.org).
Expand All @@ -13,7 +13,7 @@ StagedInstall: no
Collate: humdrumR-package.R
tools.R
Token.R
Analysis.R
Distributions.R
messages.R
Dispatch.R
humdrumR-class.R
Expand All @@ -35,6 +35,7 @@ Collate: humdrumR-package.R
Rhythm.R
Metric.R
Lyrics.R
Plots.R
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Suggests:
Expand Down
59 changes: 39 additions & 20 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ S3method("[",humCensus)
S3method("[",humInterpretations)
S3method("[",humReference)
S3method("[",humSpines)
S3method(as.data.table,distribution)
S3method(as.double,fraction)
S3method(as.integer,fraction)
S3method(as.matrix,distribution)
S3method(as.matrix,humdrumR)
S3method(as.matrix,struct)
S3method(beats,"NULL")
S3method(beats,character)
S3method(beats,meter)
S3method(as.table,distribution)
S3method(bhatk,default)
S3method(bhatk,humdrumR)
S3method(cbind,humdrum.table)
S3method(cbind,distribution)
S3method(cbind,humdrumR.table)
S3method(cbind,struct)
S3method(cbind,token)
S3method(cents,default)
Expand All @@ -22,6 +23,9 @@ S3method(chord,default)
S3method(chord,humdrumR)
S3method(context,default)
S3method(context,humdrumR)
S3method(count,default)
S3method(count,humdrumR)
S3method(count,table)
S3method(deg,default)
S3method(deg,humdrumR)
S3method(degree,default)
Expand All @@ -43,9 +47,14 @@ S3method(dur,default)
S3method(dur,humdrumR)
S3method(duration,default)
S3method(duration,humdrumR)
S3method(entropy,default)
S3method(entropy,density)
S3method(entropy,numeric)
S3method(entropy,probability)
S3method(expandPaths,humdrumR)
S3method(figuredBass,default)
S3method(figuredBass,humdrumR)
S3method(filter,distribution)
S3method(filter,humdrumR)
S3method(format,struct)
S3method(format,token)
Expand Down Expand Up @@ -87,11 +96,15 @@ S3method(kern,humdrumR)
S3method(lag,data.frame)
S3method(lag,default)
S3method(lag,matrix)
S3method(like,data.frame)
S3method(like,default)
S3method(lilypond,default)
S3method(lilypond,humdrumR)
S3method(measure,"NULL")
S3method(measure,character)
S3method(measure,meter)
S3method(metcount,default)
S3method(metcount,humdrumR)
S3method(meter,character)
S3method(meter,list)
S3method(meter,meter)
Expand All @@ -103,6 +116,8 @@ S3method(mint,humdrumR)
S3method(ms,default)
S3method(ms,humdrumR)
S3method(mutate,humdrumR)
S3method(mutualInfo,default)
S3method(mutualInfo,probability)
S3method(names,humdrumR)
S3method(nbeats,"NULL")
S3method(nbeats,character)
Expand All @@ -111,11 +126,18 @@ S3method(notehead,default)
S3method(notehead,humdrumR)
S3method(pc,default)
S3method(pc,humdrumR)
S3method(pdist,count)
S3method(pdist,data.frame)
S3method(pdist,default)
S3method(pdist,humdrumR)
S3method(pdist,probability)
S3method(pdist,table)
S3method(pitch,default)
S3method(pitch,humdrumR)
S3method(pivot_longer,humdrumR)
S3method(pivot_wider,humdrumR)
S3method(print,Excluder)
S3method(print,distribution)
S3method(print,fraction)
S3method(print,humCensus)
S3method(print,humInterpretations)
Expand All @@ -127,7 +149,7 @@ S3method(print,humdrumRmethod)
S3method(pull,humdrumR)
S3method(quarters,default)
S3method(quarters,humdrumR)
S3method(rbind,humdrum.table)
S3method(rbind,humdrumR.table)
S3method(rbind,struct)
S3method(rbind,token)
S3method(recip,default)
Expand Down Expand Up @@ -165,8 +187,6 @@ S3method(summary,humdrumR)
S3method(tactus,"NULL")
S3method(tactus,character)
S3method(tactus,meter)
S3method(tally,default)
S3method(tally,humdrumR)
S3method(tatum,"NULL")
S3method(tatum,character)
S3method(tatum,meter)
Expand Down Expand Up @@ -247,6 +267,7 @@ export(AA6)
export(AA7)
export(AA8)
export(AA9)
export(H)
export(LO5th)
export(M10)
export(M13)
Expand Down Expand Up @@ -279,14 +300,11 @@ export(anyPaths)
export(anyStops)
export(anySubcorpora)
export(as.atomic)
export(as.data.frame.humdrum.table)
export(as.data.frame.probabilityDistribution)
export(as.data.frames)
export(as.fraction)
export(as.lines)
export(as.matrices)
export(as.rational)
export(beats)
export(bhatk)
export(bpm2ms)
export(bpm2sec)
Expand All @@ -309,7 +327,6 @@ export(combineFields)
export(complement)
export(context)
export(count)
export(crossEntropy)
export(d1)
export(d10)
export(d11)
Expand Down Expand Up @@ -405,6 +422,7 @@ export(key)
export(knownInterpretations)
export(lag)
export(lead)
export(like)
export(lilypond)
export(m10)
export(m13)
Expand Down Expand Up @@ -446,8 +464,9 @@ export(order.diatonicSet)
export(order.rational)
export(order.token)
export(order.tonalInterval)
export(p)
export(pMI)
export(pc)
export(pdist)
export(pitch)
export(printSilbeFormat)
export(pull)
Expand Down Expand Up @@ -495,13 +514,14 @@ export(sumTies)
export(summarise)
export(summarize)
export(syncopation)
export(table)
export(tactus)
export(tally)
export(tandem)
export(tatum)
export(tertian)
export(tertianSet)
export(timebase)
export(timecount)
export(timeline)
export(timestamp)
export(tint)
Expand All @@ -517,6 +537,7 @@ export(unfoldStops)
export(ungroup)
export(unison)
export(validateHumdrum)
export(varnames)
export(viewKernTable)
export(windows)
export(wort)
Expand All @@ -529,7 +550,6 @@ exportMethods("!=")
exportMethods("$")
exportMethods("$<-")
exportMethods("%%")
exportMethods("%*%")
exportMethods("%/%")
exportMethods("*")
exportMethods("+")
Expand All @@ -548,6 +568,7 @@ exportMethods("rownames<-")
exportMethods(Arith)
exportMethods(Compare)
exportMethods(LO5th)
exportMethods(Math)
exportMethods(Ops)
exportMethods(Summary)
exportMethods(abs)
Expand All @@ -560,29 +581,24 @@ exportMethods(as.vector)
exportMethods(c)
exportMethods(ceiling)
exportMethods(colSums)
exportMethods(crossEntropy)
exportMethods(cumsum)
exportMethods(denominator)
exportMethods(diag)
exportMethods(diff)
exportMethods(dim)
exportMethods(draw)
exportMethods(entropy)
exportMethods(expand)
exportMethods(floor)
exportMethods(ic)
exportMethods(is.na)
exportMethods(is.numeric)
exportMethods(is.vector)
exportMethods(length)
exportMethods(max)
exportMethods(mean)
exportMethods(min)
exportMethods(mutualInfo)
exportMethods(ncol)
exportMethods(nrow)
exportMethods(numerator)
exportMethods(p)
exportMethods(prod)
exportMethods(rank)
exportMethods(round)
Expand All @@ -592,6 +608,7 @@ exportMethods(sign)
exportMethods(sort)
exportMethods(sum)
exportMethods(t)
exportMethods(table)
exportMethods(trunc)
importFrom(MASS,fractions)
importFrom(abind,abind)
Expand All @@ -602,6 +619,7 @@ importFrom(data.table,CJ)
importFrom(data.table,as.data.table)
importFrom(data.table,copy)
importFrom(data.table,data.table)
importFrom(data.table,dcast)
importFrom(data.table,frank)
importFrom(data.table,is.data.table)
importFrom(data.table,rbindlist)
Expand All @@ -612,6 +630,7 @@ importFrom(data.table,setkey)
importFrom(data.table,setnames)
importFrom(data.table,setorder)
importFrom(data.table,setorderv)
importFrom(dplyr,count)
importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,mutate)
Expand All @@ -620,7 +639,6 @@ importFrom(dplyr,reframe)
importFrom(dplyr,select)
importFrom(dplyr,summarise)
importFrom(dplyr,summarize)
importFrom(dplyr,tally)
importFrom(dplyr,ungroup)
importFrom(ggplot2,aes)
importFrom(ggplot2,geom_bar)
Expand All @@ -645,6 +663,7 @@ importFrom(stringr,str_extract)
importFrom(stringr,str_match)
importFrom(stringr,str_pad)
importFrom(stringr,str_replace)
importFrom(stringr,str_sort)
importFrom(stringr,str_split)
importFrom(stringr,str_sub)
importFrom(tidyr,pivot_longer)
Expand Down
20 changes: 20 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# humdrumR 7.0.3

### count() and table()


We wanted to use the `tally()` as humdrumR's main "count stuff" function.
Unfortunately, we found that `tally()` already exists in `dplyr` and it (the generic `tally`) can't really be extended as we'd like.
We've reimplemented everything focusing on an extension of the `dplyr::count()` function.
This also necessitated renaming a *our* (metric) `count()` function to `timecount()`.
Our `count()` method now generates a cool "distribution" table, which is easily to manipulate.
This is all mostly working pretty well, but is still a work in progress and not documented.

We've also extended `base::table()` to work with humdrumR data, but we'll be emphasizing using `count()` in our documentation.

### harte()

We've implemented parsing and deparsing of the [Harte](https://github.com/Computational-Cognitive-Musicology-Lab/Star-Wars-Thematic-Corpus) syntax for representing chords.
All our chord functions should be able to read harte notation, and there is now a `harte()` function for outputting (deparsing) **harte.


# humdrumR 7.0.0


Expand Down
8 changes: 6 additions & 2 deletions R/Chords.R
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,12 @@ tset2harm <- function(x, Key = dset(0, 0), figurationArgs = c(), ...) {
root_func = tint2romanRoot,
implicitSpecies = TRUE,
rootCase = TRUE,
natural = '#',
inversion.labels = c('', 'b', 'c', 'd', 'e', 'f', 'g'),
inversion = FALSE)

Key@Alteration[getMode(Key) == -3L & Key@Alteration == 0L] <- 1L

t2tH(x, figurationArgs = figArgs, Key = Key, ...)

}
Expand Down Expand Up @@ -1014,6 +1017,8 @@ harm2tset <- function(x, Key = dset(0,0),

Key <- romanNumeral2dset(stringr::str_sub(of, start = 2L), Key = Key, implicitSpecies = implicitSpecies, ...)
Key[is.na(Key)] <- dset(0L, 0L)
Key@Alteration[getMode(Key) == -3L & Key@Alteration == 0L] <- 1L # change minor to harmonic minor

root <- tonalChroma2tint(paste0(accidental, toupper(numeral)), useKey = TRUE,
parts = c('species', 'step'), qualities = FALSE,
implicitSpecies = implicitSpecies,
Expand Down Expand Up @@ -1071,9 +1076,8 @@ sciQualities2tset <- function(str, inversion = 0L, ...) {
}

tertian2tset <- function(x, Key = dset(0, 0), ...) {

REparse(x,
makeRE.tertian(..., collapse = FALSE), # makes root, quality, inversion, and incomplete
makeRE.tertian(..., collapse = FALSE), # makes tonalChroma, quality, inversion, and incomplete
toEnv = TRUE) -> parsed

Key <- diatonicSet(Key)
Expand Down
1 change: 0 additions & 1 deletion R/Dispatch.R
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ exclusiveDispatch <- function(x, dispatchDF, Exclusive, regexApply = TRUE, outpu

dispatchDF <- dispatchDF[sapply(dispatchDF$Exclusives, \(exc) any(Exclusive %in% exc)), ]



dispatchDF$regex <- lapply(dispatchDF$regex, \(re) if (rlang::is_function(re)) re(...) else getRE(re))

Expand Down
Loading

0 comments on commit cfc5a7c

Please sign in to comment.