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

No correct formatting in accessing multiple elements in 3D matrix #145

Closed
richelbilderbeek opened this issue May 4, 2016 · 2 comments
Closed

Comments

@richelbilderbeek
Copy link

(I attached a vignette as PDF showing this with nicer layout)

As a good friend of @lintr-bot, I found out it was impossible to satisfy him/her/it in the following occasion:

Suppose a 3D matrix:

m <- array(1:8, c(2, 2, 2))

Let's say I want the 2nd columns of the second depth.

Here, lintr will complain about the presence of a
space before the comma before the second 2:

a <- m[2, , 2]

Here, lintr will complain about the space absent after the comma of
the first 2:

b <- m[2,, 2]

This results in the following errors:

bug_report_lintr.Rmd:24:11: style: Commas should never have a space before.
a <- m[2, , 2]
bug_report_lintr.Rmd:31:10: style: Commas should always have a space after.
b <- m[2,, 2]

Thus, there is no correct formatting possible here. I suggest to allow one of these formats :-)

Thanks for lintr and @lintr-bot !

Vignette here: bug_report_lintr.pdf

@jimhester
Copy link
Member

Yes this is an issue, what do you think it is the proper format in this case?

In the meantime you can turn off linting for those lines by using # nolint at the end of the line.

@richelbilderbeek
Copy link
Author

I hoped you and Hadley would pick The Favorite Format :-)

I have a slight preference for format a, because it would allow for regexes of 'a comma and a everything-except-space' (something like ,[:nonwhitespace:]) to detect how to satisfy @lintr-bot.

Thanks for the #nolint tip, I use it as work-around until this lintr fix :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants