Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Description: A simple way of fitting detection functions to distance sampling
Horvitz-Thompson-like estimator) if survey area information is provided. See
Miller et al. (2019) <doi:10.18637/jss.v089.i01> for more information on
methods and <https://examples.distancesampling.org/> for example analyses.
Version: 2.0.0.9006
Version: 2.0.0.9007
URL: https://github.com/DistanceDevelopment/Distance/
BugReports: https://github.com/DistanceDevelopment/Distance/issues
Language: en-GB
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Fixes bug when including a uniform with no adjustment terms in the summarize_ds_models function (Issue #180)
* Users to pass a list of models to summarize_ds_models rather than passing them individually. (Issue #149)
* Truncation distances greater than the largest cutpoint value for binned data are no longer permitted as these cause fitting issues. (Issue #175)
* print.dht_result now displays estimates for groups as well as individuals by default when group size is present. (Issue #178)

# Distance 2.0.0

Expand Down
47 changes: 29 additions & 18 deletions R/print.dht_result.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,41 @@
#'
#' @export
#' @param x object of class `dht_result`
#' @param groups should abundance/density of groups be produced?
#' @param groups should abundance/density of groups be produced? TRUE
#' by default.
#' @param report should `"abundance"`, `"density"` or `"both"` be reported?
#' @param \dots unused
print.dht_result <- function(x, report="abundance", groups=FALSE, ...){
print.dht_result <- function(x, report="abundance", groups=TRUE, ...){

args <- list(...)
# Stop the general info being printed twice if there are groups
if(!is.null(args$skip.info)){
skip.info <- args$skip.info
}else{
skip.info <- FALSE
}

# general information
resulttype <- ifelse(report=="both", "abundance and density", report)
substr(resulttype, 1, 1) <- toupper(substr(resulttype, 1, 1))
cat(resulttype, "estimates from distance sampling\n")
cat("Stratification :", attr(x, "stratification"), "\n")
cat("Variance :", paste0(attr(x, "ER_var")[[1]], ","),
ifelse(attr(x, "ER_var")[[3]], "binomial",
ifelse(attr(x, "ER_var")[[2]], "N/L", "n/L")), "\n")
cat("Multipliers :", ifelse(is.null(attr(x, "multipliers")),
"none",
paste(attr(x, "multipliers"), collapse=", ")),
"\n")
cat("Sample fraction :" , ifelse(is.data.frame(attr(x, "sample_fraction")),
"multiple", attr(x, "sample_fraction")), "\n")
if(!skip.info){
resulttype <- ifelse(report=="both", "abundance and density", report)
substr(resulttype, 1, 1) <- toupper(substr(resulttype, 1, 1))
cat(resulttype, "estimates from distance sampling\n")
cat("Stratification :", attr(x, "stratification"), "\n")
cat("Variance :", paste0(attr(x, "ER_var")[[1]], ","),
ifelse(attr(x, "ER_var")[[3]], "binomial",
ifelse(attr(x, "ER_var")[[2]], "N/L", "n/L")), "\n")
cat("Multipliers :", ifelse(is.null(attr(x, "multipliers")),
"none",
paste(attr(x, "multipliers"), collapse=", ")),
"\n")
cat("Sample fraction :" , ifelse(is.data.frame(attr(x, "sample_fraction")),
"multiple", attr(x, "sample_fraction")), "\n")
}

cat("\n\n")
if(groups & !is.null(attr(x, "grouped"))){
cat("Groups:\n\n")
print(attr(x, "grouped"), report=report)
if(groups && !is.null(attr(x, "grouped"))){
cat("Groups:")
print(attr(x, "grouped"), report=report, skip.info = TRUE)
cat("\n\n")
cat("Individuals:\n\n")
}
Expand Down
5 changes: 3 additions & 2 deletions man/print.dht_result.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading