new_s3vec is a low-level constructor that takes a list of s3 objects of the same class. s3vec constructs an s3vec from individual s3 objects and as.s3vec is a S3 generic that converts existing objects. is_s3vec or is.s3vec test whether the object is an s3vec object.

s3vec(...)

new_s3vec(x)

as.s3vec(x, ...)

is.s3vec(x)

get_common_class(x)

has_common_class(x)

get_s3vec_subclass(x)

Arguments

...

Individual s3 objects

x

A list of s3 objects, or other object to coerce

Examples

a <- structure("a", class = "foo") b <- structure("b", class = "foo") new_s3vec(list(a, b))
#> [[1]] #> [1] "a" #> attr(,"class") #> [1] "foo" #> #> [[2]] #> [1] "b" #> attr(,"class") #> [1] "foo" #> #> attr(,"class") #> [1] "foo" "s3vec"
s3vec(a, b)
#> [[1]] #> [1] "a" #> attr(,"class") #> [1] "foo" #> #> [[2]] #> [1] "b" #> attr(,"class") #> [1] "foo" #> #> attr(,"class") #> [1] "foo" "s3vec"
as.s3vec(list(a, b))
#> [[1]] #> [1] "a" #> attr(,"class") #> [1] "foo" #> #> [[2]] #> [1] "b" #> attr(,"class") #> [1] "foo" #> #> attr(,"class") #> [1] "foo" "s3vec"