subset-struct-list: Manipulate structured lists

subset-struct-listR Documentation

Manipulate structured lists

Description

These functions allow generic list behaviour.

Usage

## S3 method for class 'struct_list'
c(...)

## S3 method for class 'struct_list'
rep(x, ...)

## S3 method for class 'struct_list'
x$y

## S3 method for class 'struct_list'
x[...]

## S3 replacement method for class 'struct_list'
x[...] <- value

## S3 method for class 'struct_list'
x[[...]]

## S3 replacement method for class 'struct_list'
x[[...]] <- value

Arguments

...

generic support

x

a 'struct_list'

y

item to retrieve

value

the value

Value

a 'struct_list' with all the items

Functions

  • c(struct_list): Repeat a 'struct_list'

  • rep(struct_list): Repeat a 'struct_list'

  • $: Subset a 'struct_list'

  • [: Subset a 'struct_list'

  • `[`(struct_list) <- value: Assign a subset to a 'struct_list'

  • [[: get a value from a 'struct_list'

  • `[[`(struct_list) <- value: set a single value in a 'struct_list'

Examples


x = struct(a=1,b=2,c=1:3,.class="test")
y = struct(a=4,b=5,c=1:3,.class="test")
z= tibble::tibble(a= 1:10, b=rep(c(x,y),5))

z$b

c(x,y)
c(rep(x,5),y)
class(c(rep(x,5),rep(y,5))[[1]])

as.struct_list(list(x,y))

#' x = struct(a=1,b=2,c=1:3,.class="test")
class(rep(c(x,y),5)[[1]]) == "test"
class(rep(x,5))

a = (rep(c(x,y),5))
a[[1]] = y
a


terminological/ggrrr documentation built on June 15, 2024, 6:35 a.m.