leonawicz / tabr

R package: tabr. Notation-based and tidy music data analysis and transcription.
https://leonawicz.github.io/tabr/
Other
126 stars 10 forks source link

using a list in trackbind() #33

Closed ratnanil closed 4 years ago

ratnanil commented 4 years ago

For technical reasons, I have all my tracks in a list (x_list). Is there a way to use trackbind() on a list of tracks? I'd be happy to use purrr or the like, I just haven't found a way to implement this yet.

library(tabr)
x <- phrase("c ec'g' ec'g'", "4 4 2", "5 432 432")
x1 <- track(x)
x2 <- track(x, voice = 2)
x_list <- list(x1,x2)
trackbind(x_list)
#> Error: All arguments must be `track` tables.

Created on 2020-01-25 by the reprex package (v0.3.0)

ratnanil commented 4 years ago

oh my bad.. this does the trick:

do.call(trackbind,x_list)

leonawicz commented 4 years ago

@ratnanil Hey, thanks for your question. Yeah I was just going to suggest do.call(). It's the general solution for exactly this kind of issue. Glad this works for you!