-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fixes for array indexing #31
Conversation
As simple as devtools::use_testthat().
- Added tests for array and vector slicing. - Added get.limit.index helper function to repr_matrix_df.r. Given a vector length and a desired limit, get.limit.index will return the indices for the limited vector. - Fixed minor bugs in row numbers and in using elipses as factors.
Should fix issue IRkernel#30.
oh wow, you’re awesome! 😊 |
stopifnot(obj_dim > limit) # otherwise this function should not have been run | ||
left_or_top <- seq_len(ceiling(limit / 2)) | ||
right_or_bottom <- seq.int(obj_dim - floor(limit / 2) + 1L, obj_dim) | ||
return(list(begin=left_or_top, end=right_or_bottom)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code style: spaces around =
, and no returns at the end of functions (R returns the last statement automatically)
+1 |
Woo, tests! 🎉 |
Thanks for the comments, will address them soon! |
👍 super cool, i’ll add more tests from here 😄 |
@@ -50,7 +60,7 @@ ellip.limit.arr <- function( | |||
# data.tables can't be indexed by column number, unless you provide the | |||
# with=FALSE parameter. To avoid the hassle, just convert to a normal table. | |||
if (inherits(a, 'data.table')) | |||
a <- as.data.frame(x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a bug? Otherwise, this looks strange to change that without a change which introduces a above...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems so. can’t find x
in the code above 😃
Thanks for introducing the test framework: what a nice cosy feeling when a codebase gets tested automatically :-) |
a
notx
.apply
. It seems to avoid the fix the error he had, but I'm sure there's a cleaner way to solve this.