extract_row_to_list: Extracts one row from a tibble and converts it to a list

Description Usage Arguments Value See Also Examples

View source: R/tibble.R

Description

Extracts one row from a tibble and converts it to a list

Usage

1
extract_row_to_list(tib, row_id)

Arguments

tib

the tibble

row_id

the index of the row to be selected, or alternatively an expression which will be evaluated to such an index

Value

the corresponding row from the tibble as a list

See Also

list_as_tibble tibble_as_list mapdf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(tibble)

tib <- tibble(
  a = c(1, 2),
  b = list(log10, sqrt),
  c = c("parrot", "quest"),
  .object_class = list(c("myobject", "list"), c("yourobject", "list"))
)

extract_row_to_list(tib, 2)
extract_row_to_list(tib, which(a == 1))

Example output

$a
[1] 2

$b
function (x)  .Primitive("sqrt")

$c
[1] "quest"

attr(,"class")
[1] "yourobject" "list"      
$a
[1] 1

$b
function (x)  .Primitive("log10")

$c
[1] "parrot"

attr(,"class")
[1] "myobject" "list"    

dynutils documentation built on March 22, 2021, 5:06 p.m.