Skip to content

Detection function key name not printed correctly when key = "unif" #50

@dfifield

Description

@dfifield

Hi Distance Folks,

Thanks for all your great work!

I noticed today that if you use a detection function with a unif key in a dsm, then the key name is not printed when printing the dsm object.

Minimal example

library(Distance)
library(dsm)
data(mexdolphins)

# try two ddfs, one unif and one hn
uni.mod <- ds(distdata, key= "unif", adjustment = "cos", truncation = 6000)
hn.mod <- ds(distdata, key = "hn", adjustment = "cos", truncation = 6000)

# fit a simple smooth of x and y
dsm.uni <- dsm(count~s(x, y), uni.mod, segdata, obsdata)
dsm.hn <- dsm(count~s(x, y), hn.mod, segdata, obsdata)

# Copmare output lines starting with "Detection function : " Note that the key name is missing for the dsm with uniform key. 
dsm.uni
dsm.hn

The problem

The problem is at lines 20-22 in ddf.model.description.R - there is no case in the switch for the unif key:

 key <- switch(model$ds$aux$ddfobj$type,
                hn = "Half-normal",
                hr = "Hazard-rate")

Presumably changing it to this would fix the problem?

 key <- switch(model$ds$aux$ddfobj$type,
                hn = "Half-normal",
                hr = "Hazard-rate",
                unif = "Uniform")

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions