test_stats: Test to see if Distance for Windows and R get the same...

Description Usage Arguments Details Value Status Note Examples

View source: R/test_stats.R

Description

Tests the results stored in the Distance for Windows project file against those generated from running the same analysis in R.

Usage

1
test_stats(analysis, statuses = 1, tolerance = 0.01)

Arguments

analysis

a converted (but not run) analysis

statuses

for which statuses should tests be run? See "Status", below (Defaults to 1: analysis that ran without error or warning in Distance for Windows).

tolerance

the tolerance of the test (default 0.01)

Details

A previous call to convert_project will return a list of projects. Only one analysis at a time can be run with test_stats. If you wish to run all the analyses in the project, you can use lapply.

Value

a data.frame with five columns: Statistic, a description of the tested statistic; Distance_value the value of the statistic stored by Distance for Windows; mrds_value the value of the statistic calculated by mrds; Difference the proportional difference between the previous two columns (computed using all.equal); Pass a series of ticks, indicating that the value in the Difference column is less than tolerance.

Status

The status code is taken from Distance for Windows to indicate whether the analysis has been run yet and what the outcome was. Status codes are as follows:

If an analysis has a status of 0 or 3 there will usually not be any statistics attached to the analysis, so no tests will be run.

Note that an analysis that runs with error in Distance for Windows may run fine in R and an analysis that runs fine in Distance for Windows may not work in R. In the latter case, please consider submitting this a a bug to github.com/distancedevelopment/distance-bugs.

Note

Tests all available statistics.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
library(readdst)
# load the golftees sample project and convert it
project <- system.file("Golftees-example", package="readdst")
project <- paste0(project,"/Golftees")
converted <- convert_project(project)

# run tests for analysis 1
test_stats(converted[[1]])

## End(Not run)

DistanceDevelopment/readdst documentation built on Sept. 21, 2021, 10:41 p.m.