# NOT RUN {
create_source('demo_bin')
# When a string is written into a raw block, charToRaw() is applied automatically.
put_raw_block('demo_bin', 'blk_1', 'Hello world!')
a <- get_raw_block('demo_bin', 'blk_1')
# a is raw
rawToChar(a)
# This is the same.
put_raw_block('demo_bin', 'blk_2', charToRaw('Hello again!'))
rawToChar(get_raw_block('demo_bin', 'blk_2'))
# Anything else can be written by serializing as raw.
put_raw_block('demo_bin', 'blk_3', serialize(iris, NULL))
head(unserialize(get_raw_block('demo_bin', 'blk_3')))
# Delete the block or fail
delete_block('demo_bin', 'blk_1')
# Delete will fail, but make it silent
delete_block('demo_bin', 'blk_1', silent = TRUE)
# No need to delete all blocks, they will be deleted by deleting the source.
delete_source('demo_bin')
# }
Run the code above in your browser using DataLab