Title: | R Interface to 'Redatam' Library |
---|---|
Description: | This package is deprecated. Please use 'redatamx' instead. Provides an API to work with 'Redatam' (see <https://redatam.org>) databases in both formats: 'RXDB' (new format) and 'DICX' (old format) and running 'Redatam' programs written in 'SPC' language. It's a wrapper around 'Redatam' core and provides functions to open/close a database (redatam_open()/redatam_close()), list entities and variables from the database (redatam_entities(), redatam_variables()) and execute a 'SPC' program and gets the results as data frames (redatam_query(), redatam_run()). |
Authors: | Jaime Salvador [aut, cre] , CELADE [cph] |
Maintainer: | Jaime Salvador <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.1 |
Built: | 2024-11-07 03:33:22 UTC |
Source: | https://github.com/cran/minired |
This environment is created to store the outputs generated by a Redatam program execution. The environment contains TABLES (Redatam outputs) generated from FREQ, AREALIST, MATOP, TABLIST commands. You can't modify objects contained in this environment.
outputs
outputs
An object of class environment
of length 0.
## Not run: library(minired) dic<-redatam_open("c:/nmir/nmiresp.rxdb") df<-redatam_query(dic,"tbl1<-freq person.sexo") # Accessing the tbl1 object from environment redatam::outputs$tbl1 # Accessing the output from Global Environment print(tbl1) ## End(Not run)
## Not run: library(minired) dic<-redatam_open("c:/nmir/nmiresp.rxdb") df<-redatam_query(dic,"tbl1<-freq person.sexo") # Accessing the tbl1 object from environment redatam::outputs$tbl1 # Accessing the output from Global Environment print(tbl1) ## End(Not run)
Close a REDATAM database.
redatam_close(dic)
redatam_close(dic)
dic |
Dictionary ID (returned by 'redatam.open') |
No return value.
Jaime Salvador
## Not run: dic<-redatam_open("path/to/rxdb") # run some queries using 'query' or 'run' redatam_close(dic); ## End(Not run)
## Not run: dic<-redatam_open("path/to/rxdb") # run some queries using 'query' or 'run' redatam_close(dic); ## End(Not run)
List the entities in a databse.
redatam_entities(dic)
redatam_entities(dic)
dic |
Dictionary ID (returned by 'redatam.open') |
Data frame that contains all the entities in the database.
Jaime Salvador
## Not run: dic<-redatam_open("path/to/rxdb") redatam_entities(dic); ## End(Not run)
## Not run: dic<-redatam_open("path/to/rxdb") redatam_entities(dic); ## End(Not run)
Execute a Redatam command: TABLE or AREALIST.
redatam_internal_query(dic, spc)
redatam_internal_query(dic, spc)
dic |
Dictionary identifier |
spc |
Program text in SPC format |
Raw dataset with al values: tot, na, mv, values.
Jaime Salvador
## Not run: dic<-redatam_open("path/to/rxdb") df<-redatam_internal_query(dic,"freq person.sexo") ## End(Not run)
## Not run: dic<-redatam_open("path/to/rxdb") df<-redatam_internal_query(dic,"freq person.sexo") ## End(Not run)
Execute a Redatam command: TABLE or AREALIST.
redatam_internal_run(dic, file_name)
redatam_internal_run(dic, file_name)
dic |
Dictionary identifier |
file_name |
Program file name |
Raw dataset with all values: tot, na, mv, values.
Jaime Salvador
## Not run: dic<-redatam.open("rxdb") df<-redatam.internal_run(dic,"/path/to/nmir_test.spc") ## End(Not run)
## Not run: dic<-redatam.open("rxdb") df<-redatam.internal_run(dic,"/path/to/nmir_test.spc") ## End(Not run)
Open a REDATAM database. This function returns an ID than can be used in functions to query data.
redatam_open(dictionary_name)
redatam_open(dictionary_name)
dictionary_name |
Dictionary filename |
ID than can be used in functions to query data.
Jaime Salvador
## Not run: dic<-redatam_open("path/to/rxdb") ## End(Not run)
## Not run: dic<-redatam_open("path/to/rxdb") ## End(Not run)
Execute a Redatam command: TABLE or AREALIST. This function removes all the rows that contain total, na or mv values. Additionally, this function removes the "mask" columns.
redatam_query(dic, spc, tot.omit = TRUE)
redatam_query(dic, spc, tot.omit = TRUE)
dic |
Dictionary identifier |
spc |
Program text in SPC format |
tot.omit |
Omit rows containing total, na y mv values |
If the program contains more than one table, the method returns the last table (in the SPC program) as a data frame. All the tables are registered (as data frames) in a custom environment called ‘redatam::outputs’.
Jaime Salvador
## Not run: dic<-redatam_open("path/to/rxdb") df<-redatam_query(dic,"freq person.sexo") ## End(Not run)
## Not run: dic<-redatam_open("path/to/rxdb") df<-redatam_query(dic,"freq person.sexo") ## End(Not run)
Execute a Redatam command: TABLE or AREALIST. This function removes all the rows that contain total, na or mv values. Additionally, this function removes the "mask" columns.
redatam_run(dic, file_name, tot.omit = TRUE)
redatam_run(dic, file_name, tot.omit = TRUE)
dic |
Dictionary identifier |
file_name |
Program file name |
tot.omit |
Omit rows containing total, na y mv values |
If the program contains more than one table, the method returns the last table (in the SPC program) as a data frame. All the tables are registered (as data frames) in a custom environment called ‘redatam::outputs’.
Jaime Salvador
## Not run: dic<-redatam_open("path/to/rxdb") df<-redatam_run(dic,"/path/to/nmir_test.spc") ## End(Not run)
## Not run: dic<-redatam_open("path/to/rxdb") df<-redatam_run(dic,"/path/to/nmir_test.spc") ## End(Not run)
Save a REDATAM database. This function can be used to save a dictionary.
redatam_save(dic, name = "")
redatam_save(dic, name = "")
dic |
Dictionary identifier |
name |
Dictionary filename |
No return value.
Jaime Salvador
## Not run: dic<-redatam_open("path/to/rxdb") ... redatam_save(dic,"path/to/new/dictionary.rxdb") ## End(Not run)
## Not run: dic<-redatam_open("path/to/rxdb") ... redatam_save(dic,"path/to/new/dictionary.rxdb") ## End(Not run)
List the variables in an entity.
redatam_variables(dic, entity_name)
redatam_variables(dic, entity_name)
dic |
Dictionary ID (returned by 'redatam.open') |
entity_name |
Entity's name |
Data frame that contains all the variables from the ‘entity_name’.
Jaime Salvador
## Not run: dic<-redatam_open("path/to/rxdb") redatam_variables(dic, "person") ## End(Not run)
## Not run: dic<-redatam_open("path/to/rxdb") redatam_variables(dic, "person") ## End(Not run)
Returns the current version of the native Redatam API.
redatam_version()
redatam_version()
String with the Redatam Engine version.
Jaime Salvador
redatam_version()
redatam_version()