RcppRedis provides R with an alternative to Bryan Lewis' wonderful
Both provide R with read and write access to the powerful and versatile
What is Redis?
is a wickedly fast 'key-value'
store. Sometimes it is also referred to as a 'data structure server'. It is
very widely used across web companies: name one, and they probably use it.
It is also widely supported across languages offering data interchange between
system with little effort. One can access
from the command-line, just about any
scripting language, and most compiled languages.
is actively developed, and very well
document. Just start at the Redis
What is rredis?
is a package by Bryan Lewis which offers most (if not all) Redis commands
from R. By cleverly utlising R's builtin-serialization, you can just say
redisConnect("some.server.net") # if omitted, localhost is used
redisSet("mymodel", lm(y ~ ., data=someDF))
and then in another session on either the same machine, or another machine,
fit <- redisGet("mymodel")
You can think of this as being similar to
, only across the network (and hence saving disk
access). It's very powerful, and very versatile. Plus, there are dozens of
other commands for stacks, queues, lists, pub/sub communication and much
So why another package?
We wanted to store (irregular) time series in
and the combination of repeated string-to-numeric conversion for both
timestamps and values, plus the fact that we get the result set in a list we
needed to concatenate into a vector, meant that performance was not quite
, the official C
library for Redis
, which along with
gives us an
ability to easily used compiled code to do the same. Coupled with the recently-added package
package for native R serialization from C code, we have what is needed to
perform a little better.
This is also illustrated in a complete example with timings in
presentations I gave about RcppRedis.
So in sum, the upside to RcppRedis is
- use compiled code throughoyt
- access to R native serialization as the C level
- support for the Redis binary protocol avoiding string-to-numeric conversions
Working but incomplete. Only a few Redis
commands are implemented, but the blue print for adding more is there. If you
need other commands, consider contributing.
Thanks to John Buonagurio, we also have a Windows library for
which Uwe Ligges added
to the on the CRAN / win-builder machines. Simon Urbanek had already done
the corresponding part for OS X, so the operating systems shipping pre-built
packages all do so for CRAN.
Where does it live?
Sources for the RcppRedis package are in GitHub repo
The package is available via CRAN
and its mirrors.
Patches, pull requests, issue tickets etc are most welcome at the