OpasnetBaseUtils

From Opasnet
Jump to: navigation, search

# : The code on this page should be built into the OpasnetUtils package and then the page should be merged with OpasnetUtils. --Jouni 18:45, 15 May 2013 (EEST)

Question

OpasnetBaseUtils is a collection of R functions for interaction with the Opasnet Base and manipulating data of multiple variables with multiple matching or unmatching dimensions, fitted into a neat package. What should such a package contain?

Answer

OpasnetBaseUtils contains the following functions. The functions are described in detail elsewhere (follow links).

  • op_baseGetData()
  • op_baseGetLocs()
  • op_baseWrite()
  • These functions are outdated. They are only available for compatibility issues related to old code.
    • IntArray() (and related discussion) This function has been replaced by merge().
    • DataframeToArray(). This function was used before because many calculations were made to arrays. More recently, calculations are done directly to data.frames, and they are rarely translated into arrays. It is more common to translate arrays to data.frames using as.data.frame(as.table(array)).

Rcode generic

  • Functions: dropall, PTable, opasnet.data, tidy, summary.bring

+ Show code

Rationale

A suggestion about the structure and content:

There should be just one package (at least for the time being) from Opasnet developers, namely OpasnetUtils. This contains different things:

  • OpasnetBaseUtils for connections to and from Opasnet Base.
    • Suggested function names: opbase.read (previously op_baseGetData), opbase.write (previously op_baseWrite).

--# : The original distinction between Write and GetData arose from the fact that data isn't the only thing read from the base. GetLocs also exists for getting location info on a particular data set. Of course GetLocs could be renamed locs or locations, but that loses some of the information contained in the function names. --Teemu R 09:25, 9 May 2011 (EEST)

  • Functions for some particular tasks needed in Opasnet assessments, such as functions for calculating health impacts from ERF (the function takes in RR or OR or both and automatically calculates a synthesis), exposure and background disease.
    • Suggested function names: ophia.lifetable (for life table calculation), ophia.hia (for simple impact calculation), opgis.population (for slicing population data from a database for a case), opmath.sip and opmath.unsip (for turning a random sample into a SIP and a SIP into a random sample, respectively, etc.
  • Outdated functions for compatibility reasons, such as IntArray.
  • Functions or practices for handling uncertain variables: how to merge run/obs index into a data.frame.

If the suggestion is accepted, the following things could be done to organise pages:

# : This does not seem wise, my previous experience is that files downloaded from Opasnet are cached in some very special place and I was unable to download the most recent version of a certain file, because of the similar filename. Also I think any programmer would agree that it'd be bad practice to not include an easily accessible version number on the file. Instead we should consider use of some version management system e.g. SVN. --Teemu R 09:25, 9 May 2011 (EEST)

Instructions

  1. Download File:OpasnetBaseUtils 0.8.4.zip (Save it in a location you can easily find)
  2. Open R
  3. Click "Packages" on the topbar and choose "Install package(s) from local zip files..." from the drop-down menu
  4. Locate the downloaded .zip file and install


<mfanonymousfilelist></mfanonymousfilelist>


Usage

library(OpasnetBaseUtils)

Dependencies

  • You need to have installed another package called RODBC which in turn requires the utils package. These packages are available from the CRAN repositories and can be easily installed from within R.

Change log

Forgot about this earlier so I'll add a change log now.

  • 0.8.4 - New versions of database up- and download functions added, they now support special characters properly in both opasnet and heande.

See also

  • File:OpasnetBaseUtils v.0.8.4 source.zip
    • To build from source use R CMD build <src folder> & R CMD INSTALL <src folder> in a command line on properly configured machines (most Unix systems require no configuration)
Materials and examples for training in Opasnet and open assessment
Help pages Wiki editingHow to edit wikipagesQuick reference for wiki editingDrawing graphsOpasnet policiesWatching pagesWriting formulaeWord to WikiWiki editing Advanced skills
Training assessment (examples of different objects) Training assessmentTraining exposureTraining health impactTraining costsClimate change policies and health in KuopioClimate change policies in Kuopio
Methods and concepts AssessmentVariableMethodQuestionAnswerRationaleAttributeDecisionResultObject-oriented programming in OpasnetUniversal objectStudyFormulaOpasnetBaseUtilsOpen assessmentPSSP
Terms with changed use ScopeDefinitionResultTool