Skip to contents

Converts a tibble to a srv_tbl class.

Usage

as_srv_tbl(
  x,
  milestone = "Survey tibble initialized",
  snapshot_data = FALSE,
  verbose = FALSE
)

Arguments

x

A tibble to be converted.

milestone

Character. A string representing the milestone for the snapshot. Defaults to "Survey tibble initialized".

snapshot_data

Logical. If TRUE, a snapshot of the data is taken. If FALSE, snapshot without data is taken. If NULL, no snapshot is taken.

verbose

Logical. If TRUE, prints additional messages during the conversion process.

Examples

srv <- as_srv_tbl(dplyr::tibble(x = 7))

srv
#> # A survey tibble (): 1 x 1
#>       x
#>   <dbl>
#> 1     7
srv |> print(details = TRUE)
#> # A survey tibble (): 1 x 1
#>       x
#>   <dbl>
#> 1     7
#> ✔ Lineage is attached (1 steps found): get_lineage(srv)

# Check class
class(srv)
#> [1] "srv_tbl"    "tbl_df"     "tbl"        "data.frame"

# Then you can extract lineage information and more
get_lineage(srv)
#> # A tibble: 1 × 11
#>   step    step_at             .cols  selected data    nrow  ncol hash     info  
#>   <chr>   <dttm>              <list> <list>   <list> <int> <int> <chr>    <list>
#> 1 srv_tbl 2026-09-07 04:18:25 <NULL> <NULL>   <NULL>     1     1 952927c… <NULL>
#> # ℹ 2 more variables: message <chr>, milestone <chr>
get_variables(srv)
#> # A tibble: 1 × 10
#>   variable label type  alias alias_name description alias_cols folder
#>   <chr>    <chr> <chr> <chr> <chr>      <chr>       <chr>      <chr> 
#> 1 x        NA    NA    NA    NA         NA          NA         NA    
#> # ℹ 2 more variables: folder_cols <chr>, question <chr>