Distance logo

Distance Developers Guide

Visual Basic and R

Jump down to:

Introduction

Distance currently has two R-based analysis engines:


MRDS and DSM

MRDS and DSM are R libraries. For full details see the source code repositories (see How to get DSM and MRDS R source code).


How Distance for Windows calls MRDS and DSM

Distance for Windows calls MRDS and DSM libraries as follows:

C:\PROGRA~1\R\rw1091\bin\Rcmd.exe BATCH C:\temp\dst90474\in.r C:\temp\dst90474\log.r

Distance for Windows R folder

Distance for Windows projects can contian an optional R\ folder within .dat\ project folders. This contains:


Microsoft Jet database configuration

ProjectSettingsMemo table:

Section Key Setting
AnalysisEngine DSM Description=Density surface modelling;
Order=4;
PrpProgID=D6DSMPrp.DSMProperties;
PrpLicense=gddckfaeaeefgdpfgdda;
EngIntProgID=D6DSMNEI.DSMNEngineInterface;
LogProgID=D6DSMDet.DSMLog;
LogLicense=okwkwpuiojkpsi;
ResProgID=D6DSMDet.DSMResults;
ResLicense=ghjhsjihkhhjoktllf;
PackageName=dsm;
SupportFileName=dsm.support.r;
AnalysisEngine MRDS Description=Mark-recapture distance sampling;
Order=3;
PrpProgID=D6MRDSPrp.MRDSProperties;
PrpLicense=egfekedfhgiehgperfecjd;
EngIntProgID=D6MRDSNEI.MRDSNEngineInterface;
LogProgID=D6MRDSDet.MRDSLog;
LogLicense=iiqlpghmggnmvn;
ResProgID=D6MRDSDet.MRDSResults;
ResLicense=gdbejchehdafagagja;
PackageName=mrds;
SupportFileName=mrds.support.r;
AnalysisEngineDefaultDefinition DSM Engine=DSM;
AnalysisEngineDefaultDefinition MRDS Engine=MRDS;
R Path  

The AnalysisEngine values are as follows:

Name Value
Description Human-readable description of analysis engine
Order Position in Model Definition Properties dialog
PrpProgID Properties library and class name
PrpLicense Licence key for above value, created using GenerateLicenseKey.exe
EngIntProgID NEngine interface library and class name
LogProgID Details library and Log class name
LogLicense Licence key for above value, created using GenerateLicenseKey.exe
ResProgID Results library and class name
ResLicense Licence key for above value, created using GenerateLicenseKey.exe
PackageName R package name
SupportFileName R support file name

ProjectSettingsBoolean table:

Section Key
AnalysisEngineDSM RequiresGeoObjects
AnalysisEngineDSM RunInProcess
AnalysisEngineMRDS RequiresGeoObjects
AnalysisEngineMRDS RunInProcess
R ForceLoadLibrary
R UpdateFromCRAN

DSM and MRDS Visual Basic invocation implementation overview

Only DSM is shown - MRDS is similar.

Class Analysis Engines\DSM\NEngineInterface\Classes\DSMNEngineInterface.cls:

Class Analysis Engines\DSM\NEngineInterface\Classes\DatabaseInterface.cls:

Class Analysis Engines\DSM\NEngineInterface\Classes\DataFileMaker.cls:

Class Analysis Engines\DSM\NEngineInterface\Classes\InputFileMaker.cls:

Class Analysis Engines\Shared Stuff\NEngineInterfaceUtilities\Classes\CDSProcess.cls:

Class Analysis Engines\Shared Stuff\NEngineInterfaceUtilities\Classes\InputFileMakerUtils.cls:

Class Utilities\Classes\Misc.cls:

File Analysis Engines\Shared Stuff\NEngineInterfaceUtilities\Modules\Global.bas:


MRDS and DSM implementation notes

Random numbers

R’s default random number generator is used. For more information, run, within R:

help(.Random.Seed)

MRDS main functions

DSM main functions