From e53afc8976dc4aeb7d3a26d0cf95b336e62d83a1 Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 29 Oct 2024 11:21:20 +0100 Subject: [PATCH] extend vignettes with `[` for teal_data --- vignettes/teal-data.Rmd | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/vignettes/teal-data.Rmd b/vignettes/teal-data.Rmd index 687b136d9..be619f0e7 100644 --- a/vignettes/teal-data.Rmd +++ b/vignettes/teal-data.Rmd @@ -30,18 +30,25 @@ my_data <- within( { data1 <- data.frame(id = 1:10, x = 11:20) data2 <- data.frame(id = 1:10, x = 21:30) + data3 <- data.frame(id = 1:10, x = 31:40) } ) # get objects stored in teal_data my_data[["data1"]] -my_data[["data1"]] +my_data[["data2"]] + +# limit objects stored in teal_data +my_data[c("data1", "data3")] # get reproducible code get_code(my_data) +# get code just for specific object +get_code(my_data, names = "data2") + # get or set datanames -datanames(my_data) <- c("data1", "data2") +datanames(my_data) <- c("data1", "data2", "data3") datanames(my_data) # print @@ -93,4 +100,7 @@ join_keys(my_data) <- join_keys( ) join_keys(my_data) + +# join_keys for limited object +join_keys(my_data["child"]) ```