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

datanames in vignettes #357

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion R/teal_data-constructor.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,24 @@
#' @param code (`character`, `language`) optional code to reproduce the datasets provided in `...`.
#' Note this code is not executed and the `teal_data` may not be reproducible
#'
#' Use [verify()] to verify code reproducibility .
#' Use [verify()] to verify code reproducibility.
#'
#' @details
#'
#' `teal_data` is an extension of [`teal.code::qenv`] class. Please get familiar with [`teal.code`]
gogonzo marked this conversation as resolved.
Show resolved Hide resolved
#' characteristics first.
#'
#' @section `teal_data` characteristics:
#'
#' A `teal_data` object inherits from the `environment` class (via `qenv` class), behaves like an
#' environment, and has #' the following characteristics:
gogonzo marked this conversation as resolved.
Show resolved Hide resolved
#'
#' - The environment is locked, and data modification is only possible through the `eval_code()`
gogonzo marked this conversation as resolved.
Show resolved Hide resolved
#' and `within()` functions.
#' - It stores metadata about the code used to create the data.
#' - It maintains information about relationships between datasets.
llrs-roche marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe let's get a bit into some details? But that would require describing the fields

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see we deleted those details in the vignette

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a links to the functions responsible for these topics

#' - Is immutable which means that each code evaluation does not modify the original `teal_data` object directly.
llrs-roche marked this conversation as resolved.
Show resolved Hide resolved
#'
#'
#' @return A `teal_data` object.
#'
Expand Down
2 changes: 1 addition & 1 deletion man/cdisc_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 22 additions & 1 deletion man/teal_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions vignettes/teal-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The `teal_data` class inherits from [`qenv`](https://insightsengineering.github.
## Quick Start

To create an object of class `teal_data`, use the `teal_data` function.
`teal_data` has a number of methods to manage relevant information in private class slots.
`teal_data` has a number of methods to interact with the object.

```{r, results = 'hide', message = FALSE}
library(teal.data)
Expand Down Expand Up @@ -46,6 +46,7 @@ get_code(my_data)

# get code just for specific object
get_code(my_data, names = "data2")

# get datanames
names(my_data)

Expand All @@ -56,12 +57,12 @@ print(my_data)

## `teal_data` characteristics

A `teal_data` object keeps the following information:
A `teal_data` object inherits from the `environment` class (via `qenv` class), behaves like an environment, and has the following characteristics:
llrs-roche marked this conversation as resolved.
Show resolved Hide resolved

- `env` - an environment containing data.
- `code` - a string containing code to reproduce `env` (details in [reproducibility](teal-data-reproducibility.html)).
- `names` - a character vector listing objects of interest to `teal` modules (details in [this `teal` vignette](https://insightsengineering.github.io/teal/latest-tag/articles/including-data-in-teal-applications.html)).
- `join_keys` - a `join_keys` object defining relationships between datasets (details in [Join Keys](join-keys.html)).
- The environment is locked, and data modification is only possible through the `eval_code()` and `within()` functions.
gogonzo marked this conversation as resolved.
Show resolved Hide resolved
- It stores metadata about the code used to create the data [reproducibility](#reproducibility).
- It maintains information about relationships between datasets [Join Keys](#relational-data-models).
- Is immutable which means that each code evaluation does not modify the original `teal_data` object directly.
llrs-roche marked this conversation as resolved.
Show resolved Hide resolved

### Reproducibility

Expand Down Expand Up @@ -104,8 +105,8 @@ join_keys(my_data["child"])

### Hidden objects

An object is hidden in `teal_data` if its name starts with a dot (`.`).
This can be used to pass auxiliary objects / function in the `teal_data` instance, without being visible in the `teal` summary and filter panel.
An object is hidden in `teal_data` if its name starts with a dot (`.`). This can be used to pass auxiliary objects in
the `teal_data` instance, without being visible in the `teal` summary and filter panel.

```{r}
my_data <- teal_data()
Expand All @@ -114,5 +115,6 @@ my_data <- within(my_data, {
.data2 <- data.frame(id = 1:20, data_id = c(1:10, 1:10), y = 21:30)
})

ls(my_data)
names(my_data)
```
Loading