| Title: | A Simple S3 Class for Representing Vectors of Binary Data ('BLOBS') |
| Version: | 1.2.4 |
| Description: | R's raw vector is useful for storing a single binary object. What if you want to put a vector of them in a data frame? The 'blob' package provides the blob object, a list of raw vectors, suitable for use as a column in data frame. |
| License: | MIT + file LICENSE |
| URL: | https://blob.tidyverse.org, https://github.com/tidyverse/blob |
| BugReports: | https://github.com/tidyverse/blob/issues |
| Imports: | methods, rlang, vctrs (≥ 0.2.1) |
| Suggests: | covr, crayon, pillar (≥ 1.2.1), testthat |
| Config/autostyle/scope: | line_breaks |
| Config/autostyle/strict: | false |
| Config/Needs/website: | tidyverse/tidytemplate |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.2.3 |
| NeedsCompilation: | no |
| Packaged: | 2023-03-17 09:42:50 UTC; kirill |
| Author: | Hadley Wickham [aut], Kirill Müller [cre], RStudio [cph, fnd] |
| Maintainer: | Kirill Müller <kirill@cynkra.com> |
| Repository: | CRAN |
| Date/Publication: | 2023-03-17 12:00:06 UTC |
Deprecated generic
Description
The as.blob() generic has been deprecated in favor of
the as_blob() function (for users) and the vec_cast.blob() method
(for implementers).
Implement a vec_cast.blob.myclass() method to support
coercing objects of your class to blobs.
See vctrs::vec_cast() for more detail.
Usage
as.blob(x, ...)
Arguments
x |
An object. |
... |
Passed on to methods. |
Construct a blob object
Description
new_blob() is a low-level constructor that takes a list of
raw vectors.
blob() constructs a blob from individual raw vectors.
as_blob() and is_blob() are simple forwarders to vctrs::vec_cast()
and inherits(), respectively.
Usage
blob(...)
new_blob(x = list())
validate_blob(x)
as_blob(x)
is_blob(x)
Arguments
... |
Individual raw vectors |
x |
A list of raw vectors, or other object to coerce |
See Also
as.blob() for the legacy interface for specifying casts.
Examples
x1 <- charToRaw("Good morning")
x2 <- as.raw(c(0x48, 0x65, 0x6c, 0x6c, 0x6f))
new_blob(list(x1, x2))
blob(x1, x2)
as.blob(c("Good morning", "Good evening"))
Casting
Description
Double dispatch methods to support vctrs::vec_cast().
Usage
## S3 method for class 'blob'
vec_cast(x, to, ...)
Arguments
x |
Vectors to cast. |
to |
Type to cast to. If |
... |
For |
Coercion
Description
Double dispatch methods to support vctrs::vec_ptype2().
Usage
## S3 method for class 'blob'
vec_ptype2(x, y, ..., x_arg = "", y_arg = "")
Arguments
x, y |
Vector types. |
... |
These dots are for future extensions and must be empty. |
x_arg, y_arg |
Argument names for |