object_to_string: Convert R objects to/from strings

View source: R/serialisation.R

object_to_stringR Documentation

Convert R objects to/from strings

Description

Serialise/deserialise an R object into a string. This is a very thin wrapper around the existing R functions serialize and rawToChar. This is useful to encode arbitrary R objects as string to then save in Redis (which expects a string).

Usage

object_to_string(obj)

string_to_object(str)

object_to_bin(obj)

bin_to_object(bin)

Arguments

obj

An R object to convert into a string

str

A string to convert into an R object

bin

A binary vector to convert back to an R object

Examples

s <- object_to_string(1:10)
s
string_to_object(s)
identical(string_to_object(s), 1:10)

ropensci/RedisAPI documentation built on May 18, 2022, 9:46 a.m.