-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
teal_slice
should show up in package index
#335
Comments
The documentation for these functions are robust and would be great if we can resurface this. Acceptance Criteria
|
The current issue is that We need to find a solution that only add |
Will investigate the usage of INDEX file from Writing R Extensions https://cran.r-project.org/doc/manuals/R-exts.html#The-INDEX-file |
|
@chlebowa what would you say if we put |
|
We could keep them in the same page for |
🤨 |
@chlebowa so there is multiple options: 1.We can extend description section with a sentence #' Check out [teal_slice-utilities] functions for working with `teal_slice` object. That would point to a separate documentation page The reasoning for extending the description section is that it is visible on the top of 2.The same as in 1. but we also list all utility functions in another sentence. #' Check out [teal_slice-utilities] functions for working with `teal_slice` object.
#' Class is equipped with [`is.teal_slice`], [`as.teal_slice`], [`as.list_teal.slice`], [`format.teal_slice`] and
#' [`print.teal_slice`]. 3.We create a separate section in #' @section Utility Functions:
#'
#' Check out [teal_slice-utilities] functions for working with `teal_slice` object.
#' Class is equipped with [`is.teal_slice`], [`as.teal_slice`], [`as.list_teal.slice`], [`format.teal_slice`] and
#' [`print.teal_slice`]. 4.We only extend See Also section #' @seealso [`teal_slices`], [teal_slice-utilities] ([`is.teal_slice`], [`as.teal_slice`], [`as.list_teal.slice`], [`format.teal_slice`] and
#' [`print.teal_slice`]). Separate documentation for utilitiesExamples can either stay in x1 <- teal_slice(
dataname = "data",
id = "Female adults",
expr = "SEX == 'F' & AGE >= 18",
title = "Female adults"
)
#' is.teal_slice(x1)
#' as.list(x1)
#' as.teal_slice(list(dataname = "a", varname = "var"))
#' format(x1)
#' format(x1, show_all = TRUE, trim_lines = FALSE)
#' print(x1)
#' print(x1, show_all = TRUE, trim_lines = FALSE) The separate documentation page is documented like below: #' Utility functions for `teal_slice` object
#' Convenience functions for working with `teal_slice` object.
#' @param x (`teal.slice`)
#' @param show_all (`logical(1)`) indicating whether to show all fields. If set to `FALSE`,
#' only non-NULL elements will be printed.
#' @param trim_lines (`logical(1)`) indicating whether to trim lines when printing.
#' @param ... further argument passed to other methods.
#' @seealso [`teal_slice`]
#'
#' @rdname teal_slice-utilities
#' @export
#' @keywords internal
#'
is.teal_slice <- function(x) { # nolint
inherits(x, "teal_slice")
}
#' @rdname teal_slice-utilities
#' @export
#' @keywords internal
#'
as.teal_slice <- function(x) { # nolint
checkmate::assert_list(x, names = "named")
do.call(teal_slice, x)
}
#' @rdname teal_slice-utilities
#' @export
#' @keywords internal
#'
as.list.teal_slice <- function(x, ...) {
formal_args <- setdiff(names(formals(teal_slice)), "...")
x <- if (isRunning()) {
reactiveValuesToList(x)
} else {
isolate(reactiveValuesToList(x))
}
formal_args <- intersect(formal_args, names(x))
extra_args <- rev(setdiff(names(x), formal_args))
x[c(formal_args, extra_args)]
}
#' @rdname teal_slice-utilities
#' @export
#' @keywords internal
#'
format.teal_slice <- function(x, show_all = FALSE, trim_lines = TRUE, ...) {
checkmate::assert_flag(show_all)
checkmate::assert_flag(trim_lines)
x_list <- as.list(x)
if (!show_all) x_list <- Filter(Negate(is.null), x_list)
jsonify(x_list, trim_lines)
}
#' @rdname teal_slice-utilities
#' @export
#' @keywords internal
#'
print.teal_slice <- function(x, ...) {
cat(format(x, ...))
} |
So they're not on the same page 😃 |
We can use |
Can you try the |
Yes, I think I've got this. Will create PR |
Sorry. needed to rename the branch and created new PR #565 |
@chlebowa @m7pr After reviewing and observing all the workarounds that both of you had to implement in #565, I am impressed but also concerned about the maintenance aspect of this in the future. Personally, I think we should just make the utility functions into a separate Rd file so that we can display only Looking at @m7pr proposal, I prefer a combination of options 3 and 4. I should add that these utilities functions are already shown in |
@averissimo I know you also spent some time yesterday on this. Any thoughts, or wishes, or blessings? |
Blessing to your latest suggestion!! 💯 You did an awesome job there and I agree with it
Yesterday I tried creating a mirror of the Having a small doc that directs to ps. learned about TIL about |
Wait, I think I'm on to something. |
@chlebowa I was not planning to push. I was actually thinking of us taking a step back and giving us some time to think about something different for the next 2-3 days :) ! Fingers crossed for your newest idea! |
HAHA |
SummaryHey gang, so a small summary of the current state (especially for @pawelru). The goalThe issue that this card tried to solve was that What we tried
|
Let me ask you a quick question. Why do we have Lines 130 to 136 in 255283d
If we remove it the problem is gone - am I right? If it happens that there is a non-exported functionality - why to put it into the exported functionality manual? This supposed to be documented in another article - also the problem should be gone. |
Because we want that function exported but not on the index. |
Please don't make me say that |
|
Why do we don't want it to be in the index? |
What's wrong with the above? I have to admit that I personally see it as a lesser devil compared to the alternative of modifying
EDIT: Also, I am trying to workaround the problem as it seems that there are no good way of solving it. |
I beg to differ. |
I don't think we are the very first and only ones who discover this so let me find what others do:
My point is - it looks like this is totally fine to put rd-linked methods as a separate entries in the index (i.e. not add keywords internal). It looks to be totally fine by the community - noone raise an issue about it. You might have a different view so let's formulate a problem and challenge this from a different angle. It is not supported to have an index listed topic that includes object with additional I am personally ok with either. IMHO, both are way better and safer than modifying index file on install. |
Hey, just pulling up what others wrote before:
If we create a separate page that is linked from |
@chlebowa your propositions of solutions undoubtedly showcases your high standards and unique approach, which we truly admire. It's evident that a lot of thought and expertise went into its development, and for that, we commend you. Your dedication to ensuring excellence and your willingness to go the extra mile haven't gone unnoticed by the team! However, after looking at the previous discussions and considerations from other team members, I think I can tell we've collectively decided to move forward with a simpler solution: creating separate pages for utility functions (one for teal_slice-utilities and the other one for teal_slices-utilities). While we recognize the merits of your innovative approach, the consensus leans towards a solution that aligns more closely with standard practices (no editions to index.html during the installation of the package). I want to assure you that your efforts haven't been in vain. In fact, your solution has provided valuable learning opportunities for everyone involved, enriching our understanding of the problem (package installation parts, creation of index file). Before finalizing the decision, I wanted to check in with you to ensure you're comfortable with this direction. Your input is highly valued, and we want to make sure that we're all on the same page moving forward. |
I still |
Created a PR to solve this issue #572 |
…ges for `teal_slice(s)` utilities (#572) Closes #335 - Created separate documentation page for `teal_slice-utilities` - included `is.teal_slice`, `as.teal_slice`, `as.list.teal_slice`, `print.teal_slice`, `format.teal_slice` - inheriting params from `teal_slice` - inheriting examples from `teal_slice` - man page contains `@keywords internal` so does not appear in package index - `teal_slice` man page - extended `@seealso` section to point to utility functions - utility functions mentioned in the `@description` of the page - utilities visible in examples Did the same for `teal_slices` and respective utility functions. Utility functions are not visible in package index, where `teal_slice` and `teal_slices` were brought back to package index <img width="514" alt="image" src="https://github.com/insightsengineering/teal.slice/assets/133694481/748cb0ba-6e5d-414b-9ae8-ef3b77348e22"> --------- Co-authored-by: Dony Unardi <[email protected]>
The
teal_slice
help topic extensively documents theteal_slice
andteal_slices
classes and explains at length how filter states are defined and handled. Although all the functions in that topic are not exported, I believeteal_slice
should be visible in the package index in RStudio's Help tab.The text was updated successfully, but these errors were encountered: