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

print.xts produces error if provided with "quote" or "right" arguments #401

Closed
WillemMaetens opened this issue Jun 21, 2023 · 3 comments
Closed
Labels
Milestone

Comments

@WillemMaetens
Copy link

WillemMaetens commented Jun 21, 2023

Description

print.xts() contains code to handle "quote" or "right" arguments by setting them explicitly in the call to print.default(), but in doing so produces an error if they are already in the ellipsis argument:

Error in print.default(y, quote = quote, right = right, ...) : formal argument "quote" (and/or "right") matched by multiple actual arguments.

Expected behavior

No error is produced if "quote" or "right" arguments are included in call to print.xts(). Set "quote" and "right" values in the ellipsis arguments and not explicitly in the call to print.default().

Minimal, reproducible example

data(sample_matrix)
sample.xts <- as.xts(sample_matrix)
print(sample.xts, quote = TRUE)
print(sample.xts, right = TRUE)

### Session Info
R version 4.3.0 (2023-04-21 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8  LC_CTYPE=English_United Kingdom.utf8
[3] LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.utf8    

time zone: Europe/Berlin
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] xts_0.13.1 zoo_1.8-12

loaded via a namespace (and not attached):
[1] compiler_4.3.0 tools_4.3.0    grid_4.3.0     lattice_0.21-8
@joshuaulrich
Copy link
Owner

Thanks for the report. This is definitely a bug.

@WillemMaetens
Copy link
Author

If it's useful, I created a branch that solves the issue and also implements xtsAttribute printing functionality in print.xts (was actually doing that when I noticed the bug): https://github.com/WillemMaetens/xts-mods/tree/print.xts

@joshuaulrich
Copy link
Owner

That was very useful, thank you!

@joshuaulrich joshuaulrich added this to the 0.13.2 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants