How to test is.blob

I was hoping to select columns in a dataframe of type "blob" (using where)
There is no is.blob function
Is there a robust way of creating it myself?

is() can tell you the type of something but also test if something has that type.

library(blob)

x1 <- charToRaw("Good morning")
x2 <- as.raw(c(0x48, 0x65, 0x6c, 0x6c, 0x6f))

y <- new_blob(list(x1, x2))

is(y)
## [1] "blob"          "vctrs_list_of" "vctrs_vctr"    "oldClass"     

is(y, "blob")
## [1] TRUE

Thank you. To use with where I will use:

is.blob <- function(x) {
  !is.na(match("blob", is(x)))
}

I think you might just be able to go

is.blob <- function(x) {
  is(x, "blob")
}
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.