-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
datanames in vignettes #239
base: main
Are you sure you want to change the base?
Conversation
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.
- @averissimo I'm thinking to move description of
eval_code
,within
,get_code
away from details ofqenv
to a new section "Interacting withqenv
".
Keeping it in @details
makes it consistent with other R documentation and our own.
But I'm not opposed to this change if it improves the readability
Yup, I think it is fine now. It was my first thought with the |
Code Coverage Summary
Diff against main
Results for commit: a44e53c Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Tests Summary 1 files 12 suites 3s ⏱️ Results for commit a44e53c. ♻️ This comment has been updated with latest results. |
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.
Looking good! I've added a few comments
R/qenv-within.R
Outdated
#' | ||
#' @section Using language objects with `within`: | ||
#' Passing language objects to `expr` is generally not intended but can be achieved with `do.call`. | ||
#' Only single `expression`s will work and substitution is not available. See examples. | ||
#' | ||
#' @param data (`qenv`) | ||
#' @param expr (`expression`) to evaluate. Must be inline code, see `Using language objects...` | ||
#' @param ... see `Details` | ||
#' @param ... (`named`) argument value will substitute a symbol in the `expr` matched by the name. | ||
#' For practical examples see the #usage. |
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.
#usage alone is not generating a link, the suggestion bellow creates it on pkgdown
but not on the man page (those don't have HTML id in order for the anchor to work)
#' For practical examples see the #usage. | |
#' For practical examples see the [usage](#ref-usage) 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.
at least in rstudio
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.
Yeah, I meant For practical usage see the examples - changed but I don't know how to link Examples section. I don't think it is necessary but would be nice
Co-authored-by: André Veríssimo <[email protected]> Signed-off-by: Dawid Kałędkowski <[email protected]>
… 338_datanames_in_vignettes
Co-authored-by: André Veríssimo <[email protected]> Signed-off-by: Dawid Kałędkowski <[email protected]>
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.
Great job with the custom print method, the grayed out names is a brilliant touch
I think it works great with most cases I can think of. It doesn't show the right class with rlang::missing_arg()
, but that is a very special case
pkgload::load_all("teal.code", export_all = TRUE)
weird_classes <- qenv() |>
within({
a <- 2
b <- 5 + 1i
c <- 10L
.d_e <- new.env()
data("miniACC", package = "MultiAssayExperiment", envir = .d_e)
.d <- .d_e$miniACC
e <- structure(list(1), class = c("yada", "bla"))
.f <- iris
` a very !weird name` <- R6::R6Class("A", public = list(a = 1))
an_r6_instance <- R6::R6Class("A Class", public = list(a = 1))$new()
g <- structure(list(1), class = "override")
class(g) <- 2
h <- function(x) 1234
x <- rlang::missing_arg()
y <- quote(foo)
z <- expression(1+1)
})
weird_classes
#> <environment: 0x6132e7c2c728> [L]
#> Parent: <environment: package:MultiAssayExperiment>
#> - ` a very !weird name`: [R6ClassGenerator]
#> - a: [numeric]
#> - an_r6_instance: [A Class]
#> - b: [complex]
#> - c: [integer]
#> - e: [yada]
#> - g: [2]
#> - h: [function]
#> - x: [name]
#> - y: [name]
#> - z: [expression]
#> - .d: [MultiAssayExperiment]
#> - .d_e: [environment]
#> - .f: [data.frame]
rlang::env_print(as.environment(weird_classes))
#> <environment: 0x6132e7c2c728> [L]
#> Parent: <environment: package:MultiAssayExperiment>
#> Bindings:
#> • x: <missing> [L]
#> • y: <sym> [L]
#> • z: <expression> [L]
#> • a: <dbl> [L]
#> • b: <cpl> [L]
#> • c: <int> [L]
#> • e: <yada> [L]
#> • an_r6_instance: <A Class> [L]
#> • g: <2> [L]
#> • h: <fn> [L]
#> • ` a very !weird name`: <R6ClssGn> [L]
#> • .d_e: <env> [L]
#> • .d: <MltAssyE> [L]
#> • .f: <df[,5]> [L]
Created on 2024-12-20 with reprex v2.1.1
- Bindings:
sprintf( | ||
"- %s: [%s]\n", | ||
deparse(rlang::sym(x), backtick = TRUE), | ||
class(object[[x]])[1] |
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.
WDYT about using pillar::type_sum
to get the class type?
We would use the same naming as tidyverse
and it would get some extra specificity/weird cases (numeric
-> dbl
, rlang::missing_arg/symbol/quote/name and I'm sure some others)
The loss here would be shorter names and an extra dependency just for the show.qenv
method
(same to be applied to hidden
class below)
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.
I'm not a fan of changing original class names neither using extra dependency for it
Co-authored-by: André Veríssimo <[email protected]> Signed-off-by: Dawid Kałędkowski <[email protected]>
Refers to #338
environment
.eval_code
,within
,get_code
away from details ofqenv
to a new section "Interacting withqenv
".qenv
environment" instead of "qenv
object" to emphasize it is an environment.