opbase: OpasnetBase Access

Description Usage Arguments Details Value Author(s) Examples

Description

Function family for interacting with the Opasnet database.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
opbase.data(ident, series_id = NULL, subset = NULL, verbose = FALSE, 
    username = NULL, password = NULL, samples = NULL, exclude = NULL, 
    include = NULL,  range = NULL, optim_test = TRUE, ...)
opbase.locations(ident, index_name, series_id = NULL, username = NULL, 
    password = NULL)
opbase.obj.exists(ident, username = NULL, password = NULL)
opbase.series(ident, username = NULL, password = NULL, verbose = FALSE)
opbase.indices(ident, act = NULL, username = NULL, password = NULL, verbose = FALSE)
opbase.upload(input, ident = NULL, name = NULL, subset = NULL, 
    obj_type = "variable", act_type = "replace", language = "eng", 
    unit = "", who = NULL, rescol = NULL, chunk_size = NULL, verbose = FALSE, 
    username = NULL, password = NULL, index_units = NULL, index_types = NULL)

Arguments

ident

Object ident as string (e.g. "op_en1390"). Optional when uploading within Opasnet; page ident will be taken from the page where the code is.

series_id

Series identifier as integer.

act

Act identifier as integer.

index_name

Column name (index) whose locations should be returned.

subset

Subset data name. Objects can have subsets of data, identified by subset names.

verbose

Flag to view detailed debug output.

username

Opasnet Base username.

password

Opasnet Base password.

samples

Limit the number of samples in result. Default is to get them all.

exclude

Filter result by excluding rows that contain locations defined here as list. Works only with entity type indices!

include

Filter result by only including rows that contain locations defined here as list. Works only with entity type indices!

range

Filter result by setting ranges for index location values. Works only with number and time type indices!

optim_test

Generally faster download, slower only when downloading large probability distributions from the database.

input

Input data as data.frame.

name

Object name for upload.

obj_type

Object type string: 'variable', 'study', 'method', 'assessment', 'class', 'nugget' or 'encyclopedia'.

act_type

Act type string: 'replace' or 'append'. Replace type uploads data to new series. Append adds new act to latest series.

language

Data language identifier string in ISO 639.2 standard.

unit

String identifying the result unit(s).

who

Name or alias of the data uploading person.

rescol

Name of the result column index.

chunk_size

Size of upload data chunk in rows.

index_units

Units for indices in vector as strings. E.g. c('cm2','m2','ug/m3').

index_types

Types for indices in vector as strings. Possible types are: 'entity' for limited set of locations, 'number' for real numbers and 'time' for date time strings. E.g. c('entity','entity','number').

...

Excess arguments are ignored.

Details

This family of functions provide access to Opasnet Base -database. Opasnet Base is the database used for storing Opasnet data. Use the opbase.data function to read data from the database and the opbase.upload function to upload data to the database. Note that uploading data from local R-installation requires Opasnet Base username and password. These can be obtained only by trusted people.

Exclude and include syntax: list = ('<index name 1>' = c('<location value 1>', '<location value 2>',...), '<index name 2>' = c('<location value 1>', '<location value 2>',...), ...)

Range syntax: list = ('<index name 1>' = c(<range from>|NA, <range to>|NA), '<index name 2>' = c(<range from>|NA, <range to>|NA), ...)

See also: http://www.loc.gov/standards/iso639-2/php/code_list.php
http://en.opasnet.org/

Value

opbase.data

Returns data.frame containing the query result data.

opbase.locations

Returns list of locations and their ids (as keys).

opbase.obj.exists

Returns TRUE if object exists, FALSE if not.

opbase.series

Returns vector of series ids.

opbase.indices

Returns a character vector of data indices.

opbase.upload

Returns total number of data rows uploaded.

Author(s)

E. Happonen [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# Read

opbase.data('op_en1390')
opbase.data('op_en2949', subset='2012', include = list('KUNTA' = 322), 
    range = list('ID_NRO' = c(20000, 30000), 'XKOORD' = c(NA,244000)))

# Write (works only within Opasnet when username nor password is given)
input <- matrix(c('male', 12334435.123, 22, 'female', 234345.23423, 33), 
    ncol=3, byrow=TRUE)
colnames(input) <- c("Sex","Some number","result")
input <- as.data.frame(input)
#res <- opbase.upload(input, ident="op_en1390", name = "Sandbox TEST", 
#    index_types = c('entity','number'), unit = "Age", who='Tester person')

## End(Not run)

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