Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it so readHumdrum() can be fed a url. #21

Open
SileYin opened this issue Apr 24, 2023 · 1 comment
Open

Make it so readHumdrum() can be fed a url. #21

SileYin opened this issue Apr 24, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@SileYin
Copy link
Collaborator

SileYin commented Apr 24, 2023

There is a base-R url() function. It would be nice if readHumdrum could somehow read either a single file or a collection of files directly from a url.

For example, there is a single file here: https://raw.githubusercontent.com/josquin-research-project/Jos/main/Jos0703b-Missa_Dung_aultre_amer-Gloria.krn

@SileYin SileYin self-assigned this Apr 24, 2023
@SileYin
Copy link
Collaborator Author

SileYin commented Apr 24, 2023

Now supports read single file from url string in branch read_from_url.

I can successfully load a humdrum file such as:

readHumdrum('https://raw.githubusercontent.com/Computational-Cognitive-Musicology-Lab/humdrumR/main/inst/HumdrumData/BachChorales/chor001.krn')

However, I don't know whether it is because of this specific file or something else, reading this file gives me error:

readHumdrum('https://raw.githubusercontent.com/josquin-research-project/Jos/main/Jos0703b-Missa_Dung_aultre_amer-Gloria.krn')
Finding and reading files...
	REpath-pattern 'https://raw.githubusercontent.com/josquin-research-project/Jos/main/Jos0703b-Missa_Dung_aultre_amer-Gloria.krn' matches 1 text files in 1 directory.
One files read from disk.
Validating one files...all valid.
Parsing one files...
Error in mat[, 1] : subscript out of bounds
9.
is.factor(x)
8.
grepl("^\\*>", spine) at Read.R#1223
7.
parseSections(mat[, 1]) at Read.R#863
6.
parseLocal(records) at Read.R#740
5.
parseRecords(file, piece, reference) at Read.R#688
4.
(function (file, piece)
{
humtab <- parseRecords(file, piece, reference)
if (verbose) ...
3.
mapply(FUN = f, ..., SIMPLIFY = FALSE)
2.
Map(function(file, piece) {
humtab <- parseRecords(file, piece, reference)
if (verbose)
message(filename, "\n") ... at Read.R#686
1.
readHumdrum("https://raw.githubusercontent.com/josquin-research-project/Jos/main/Jos0703b-Missa_Dung_aultre_amer-Gloria.krn")

@natsguitar natsguitar added the enhancement New feature or request label Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants