objects: Server side shared R objects

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Library for using R objects (like ovariables.) stored in Opasnet R server. Also includes basic encryption and decryption functionality for R objects.

Usage

1
2
3
4
5
6
objects.encode(obj, key)
objects.decode(eobj, key)
objects.get(token, print_names = TRUE)
objects.latest(page_ident, code_name, verbose = FALSE, ...)
objects.put(..., list = character())
objects.store(..., list = character(), verbose = FALSE)

Arguments

obj

Any R object.

eobj

An encoded object returned by objects.encode function.

key

Key string to encode or decode objects. Must be 16,32 or 64 characters in length.

token

R-tools run token string to identify a stored object on Opasnet R server.

print_names

if TRUE prints the names of all the downloaded objects (sets load(verbose = TRUE))

page_ident

Opasnet Media Wiki page identifier (e.g. op_en1390).

code_name

Name of the R code block in Opasnet Media Wiki (the name argument in rcode tag).

verbose

Flag to set more verbose output (for debug purposes).

...

Objects will be passed straight to R core save function. In case of objects.latest ... are passed on to objects.get.

list

List will be passed straight to R core save function.

Details

The main purpose of this library is to provide means to store R objects to Opasnet R server for later use. This is specifically useful and embraced in Opasnet R ecosystem where this library is mainly used for storing and fetching ovariables. Storing objects is currently only possible within Opasnet Media Wiki environments (using R code inside rcode tags), but reading objects stored by running code within public wikis is also possible from local R-installation.

Besides object storing, this library provides basic functionality to encode and decode R objects. This is done by using R base serialization functions and digest library. Objects given to objects.encode will be encoded by using AES function in "ECB" mode. Longer key (16, 32 or 64 characters) obviously means more secured encryption too. Same key must be used for both encryption and decryption.

See also: http://en.opasnet.org/

Value

objects.encode

Returns encoded object to be decoded with objects.decode and given key.

objects.decode

Returns decoded object, as it was before encoding with objects.encode.

objects.get

Returns object or objects stored to Opasnet R server.

objects.latest

Returns object or objects stored to Opasnet R server.

objects.put

No return value.

objects.store

Returns token to identify stored objects on R server.

Author(s)

E. Happonen [email protected]

See Also

load
save
serialize
AES

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Within Opasnet only! Let's assume that the (en.opasnet.org) page identifier - 
# where to code is - would be "Op_en1390" and code name "objs_save_test".
x <- stats::runif(20)
y <- list(a = 1, b = TRUE, c = "Jeah baby jeah!")
## Not run: 
objects.store(x, y)

## End(Not run)
# Fetching can be done also from local R installation.
## Not run: 
objects.latest("Op_en1390","objs_save_test")

## End(Not run)
print(x)
print(y)

# Object encrypt and decrypt

key <- "1234567890abcdef"

eobj <- objects.encode(y, key)
print(eobj)
obj <- objects.decode(eobj, key)
print(obj)

OpasnetUtils documentation built on July 4, 2017, 9:44 a.m.