-
-
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
Adds names()
function and deprecates datanames()
#347
base: main
Are you sure you want to change the base?
Conversation
#' @rdname datanames | ||
#' @export | ||
#' @keywords internal | ||
`names<-.teal_data` <- function(x, value) { |
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 acknowledge introducing names<-
just to deprecate itself
#' | ||
#' @export | ||
names.teal_data <- function(x) { | ||
names_x <- names(as.environment(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.
Using names
in body which will return all objects, including with dot prefix.
I don't think it makes sense to use ls(x, all.names = FALSE)
as that changes the way the function works.
We could add support to ls
via some trickery, but I'm leaning against it, mainly as it will appear as masking ls
when loading the package.
#' @export
ls <- function(x, ...) {
UseMethod("ls")
}
#' @export
ls.teal_data <- function(x, ...) {
names_x <- base::ls(as.environment(x), ...)
.get_sorted_names(names_x, join_keys(x), as.environment(x))
}
#' @export
ls.default <- function(x, ...) {
base::ls(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.
Note that by using names here, we need to make some changes to teal
summary table (as that should be ordered with this behavior in mind)
Pull Request
names(qenv/qenv.error)
S3 methods teal.code#218Blockers
{teal.code}
names(qenv/qenv.error)
S3 methods teal.code#218Changes description
names()
functiondatanames()
getter and setter