Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pkgdown #181

Merged
merged 32 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
818edbe
get Clarity tracking on all pages
erex May 10, 2024
ad83d22
pkgdown build and gitignore includes docs
erex May 10, 2024
037964a
Clarity footnote added
erex May 10, 2024
c8d298d
added two missing vignettes: differences and multispecies caution
erex May 11, 2024
c70f5c0
rebuilt distance pkgdown hoping ctds is well behaved
erex May 23, 2024
16d8b3e
spelling and lowercase ctds directory
erex May 24, 2024
8513f1a
spelling
erex May 24, 2024
b248a68
folder naming hassle
erex May 24, 2024
30e5468
fingers crossed about CTDS vignette folder
erex May 24, 2024
51c34e9
sorted the ctds folder name issue
erex May 24, 2024
c652894
Merge branch 'master' into make_pkgdown
LHMarshall Nov 6, 2024
19cbce7
first rebuild since Distance 2.0.0
erex Nov 6, 2024
56723a3
gradual build of vignettes, step 1 main 3
erex Nov 7, 2024
7b7b351
stage 2 of vignette production
erex Nov 7, 2024
3fdd5f9
third group of case studies in Distance package
erex Nov 7, 2024
994e788
last (for today) set of distance articles created
erex Nov 7, 2024
37db53b
readme directs to articles page
erex Nov 7, 2024
a873671
New alt-optimise and camera-distill vignettes
lenthomas Nov 8, 2024
21c9ed5
Len's two vignettes rebuilt and uploaded
erex Nov 8, 2024
8c772fd
typo in alt-optimiser vignette
erex Nov 8, 2024
906cba9
footer with email donation
erex Nov 13, 2024
fcda6ba
mcds exe article
erex Nov 13, 2024
f9f4e81
three main vignettes with new footers
erex Nov 13, 2024
6858c84
increments toward pkgbuild
erex Nov 13, 2024
cde8185
pkgdown Distance site with donation email footer
erex Nov 13, 2024
9e4c3d1
manually insert clarity.txt into the includes: part of _pkgdown.yml
erex Nov 18, 2024
353528b
clarity is fixed in _pkgdown.yml
erex Nov 18, 2024
682e66e
Closes #179
LHMarshall Nov 22, 2024
27da481
Closes #180
LHMarshall Nov 22, 2024
2017d72
missing \dontrun{ ...}
LHMarshall Nov 22, 2024
5d581d4
Re-ran CTDS example
lenthomas Nov 24, 2024
d398141
Make CRAN compliant
LHMarshall Dec 2, 2024
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
7 changes: 6 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ cran-comments.md
^codecov\.yml$
^\.github$
^CRAN-SUBMISSION$
README.md
README.md
^_pkgdown\.yml$
^docs$
^pkgdown$
Clarity.txt
^vignettes
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.Rproj
cran-comments.md
.DS_Store

7 changes: 7 additions & 0 deletions Clarity.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script type="text/javascript">
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "m9rbql4acz");
</script>
8 changes: 6 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Package: Distance
Maintainer: Laura Marshall <[email protected]>
License: GPL (>= 2)
Title: Distance Sampling Detection Function and Abundance Estimation
LazyLoad: yes
Expand All @@ -17,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
Version: 2.0.0.9001
URL: https://github.com/DistanceDevelopment/Distance/
BugReports: https://github.com/DistanceDevelopment/Distance/issues
Language: en-GB
Expand All @@ -29,6 +28,10 @@ Imports:
methods,
rlang
Suggests:
rmarkdown,
kableExtra,
bookdown,
knitr,
covr,
progress,
parallel,
Expand All @@ -42,3 +45,4 @@ Suggests:
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
VignetteBuilder: knitr
86 changes: 32 additions & 54 deletions NEWS → NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Distance 2.0.0
----------------------
# Distance 2.0.1

* Fixes issue with print dht2 when multipliers are a data.frame (Issue #179)
* Fixes bug when including a uniform with no adjustment terms in the summarize_ds_models function (Issue #180)

# Distance 2.0.0

* Requires mrds 3.0.0. mrds is called by ds for fitting detection functions. In mrds there has been a change of optimizer used for CDS detection functions - a constraint solver slsqp now used. This removes the need for external optimizer MCDS.exe in most cases. Other minor changes to optimization have been implemented to improve reliability (see NEWS file of mrds for more info).
* New argument mono_method added so that the previous constraint solver (solnp) can still be used. MCDS.exe is also still available if needed.

Distance 1.0.9
----------------------
# Distance 1.0.9

* Changed the default encounter rate estimator for point transect surveys from P3 to P2. (Issue #138)
* Fixed bug which produced NA's when stratum names came after 'Total' in the alphabet. (Issue #158)
Expand All @@ -14,20 +17,17 @@ Distance 1.0.9
* Added a warning for the dht bootstrap when Sample.Label values are not unique across all strata. (Issue #157)
* Distance 1.0.9 depends on mrds >= 2.3.0 due to re-named documentation page links.

Distance 1.0.8
----------------------
# Distance 1.0.8

* Support for using MCDS.exe from Distance for Windows to run analyses. You can now download MCDS.exe using mrds::download_MCDS_dot_exe run analyses using this engine, rather (or in tandem with) the usual R optimizers provided in mrds. ds will pick the best (by likelihood) and return that. See ?ds and ?"mcds-dot-exe" for more details.

Distance 1.0.7
----------------------
# Distance 1.0.7

* dht2 now requires the object field in flatfile formatted data. The following vignette shows how to add an object field if your data does not have already have one: https://examples.distancesampling.org/Distance-cameratraps/camera-distill.html
* Fix bugs when a uniform is fitted with no adjustments
* Fixed error in dht2 when binned data used distend / distbegin

Distance 1.0.6
----------------------
# Distance 1.0.6

* Fix bug in auto binning data when using flatfile (#116)
* convert.units in bootdht() was not properly implemented in previous release, fixed (#122)
Expand All @@ -36,8 +36,7 @@ Distance 1.0.6
* fix bug in covered area calculation for dht2, this fixes incorrect density estimate under left truncation (#135)
* experimental support for multiple detection functions in dht2, joint work T.J. Clark-Wolf, funded by Environment Canada. Note that now the object field is required in data supplied to dht2.

Distance 1.0.5
----------------------
# Distance 1.0.5

* To improve consistency in functions and arguments in the package, some functions and arguments have changed from . separation to _. An error is now thrown when the "old" arguments/functions using . are used. This error will be removed in Distance 1.0.6.
* create.bins() -> create_bins()
Expand All @@ -59,8 +58,7 @@ Distance 1.0.5
* order argument to ds() is now only used to specify order, to fix a given number of adjustments use the new argument nadj (see ?ds for more info)
* fix bug where polynomial adjustments started at the wrong order (2 rather than 4)

Distance 1.0.4
----------------------
# Distance 1.0.4

* fix bootdht issue where the arguments for ds() were not found
* bootdht_Nhat_summarize now reports the stratum labels as well as their abundance estimates for ease of use
Expand All @@ -71,8 +69,7 @@ Distance 1.0.4
* fix issue in Hermite adjustment order calculation when length(order)>1
* set.seed can now be used with bootdht in parallel to obtain reproducible bootstrap results

Distance 1.0.3
----------------------
# Distance 1.0.3

* fix bug in dht2 where warnings were thrown if object column was not in the flatfile (https://github.com/DistanceDevelopment/Distance/issues/83)
* removed silent=TRUE in try() around model fitting to enable users to get error messages from mrds during fitting. Old behaviour can be recovered using quiet=TRUE argument to ds()
Expand All @@ -88,15 +85,13 @@ Distance 1.0.3
* Sample fraction may now be specified as a data.frame if fractions are different for each transect
* Fix various bugs in dht2 when stratification="replicate", thanks to Sam Ball and Jamie McKaughan for reporting issues and testing.

Distance 1.0.2
----------------------
# Distance 1.0.2

* ds.gof is now deprecated for goodness-of-fit testing. gof_ds is now preferred.
* add_df_covar_line (actually located in mrds) can now plot probability density functioins for point transects
* bootdht can now use the progress package if installed to give an estimated time remaining for bootstraps (option progress_bar="progress"). Alternatively no progress bar can be shown with progress_bar="none".

Distance 1.0.1
----------------------
# Distance 1.0.1

* fix bug in dht2 when object IDs were not specified in flatfile formatted data
* fix bugs in bootdht where the function crashed if all models failed to fit and when the hessian couldn't be computed
Expand All @@ -108,17 +103,15 @@ Distance 1.0.1
* Fix to dht2 bugs when Innes et al estimator is used for encounter rate variance estimation
* fix bootdht issue where convert.units argument was not handled properly

Distance 1.0.0
----------------------
# Distance 1.0.0

* call now saved in the model object as `$call`
* Added lots of example data sets
* new abundance estimation via dht2! Handles more complex situations.
* bootstrap variance estimation via bootdht
* for more examples see http://examples.distancesampling.org

Distance 0.9.8
----------------------
# Distance 0.9.8

* Includes reference and citation for paper on 'Distance Sampling in R'.
* AIC now works for multiple models at once (as it does for other model classes) thanks to Tiago Marques and Len Thomas for this suggestion.
Expand All @@ -127,14 +120,12 @@ Distance 0.9.8
* when distbegin and distend were specified in the data but distance wasn't, checkdata() threw an error. checkdata() now generates the distance column at the midpoint. Thanks to Tom for spotting this.
* new argument to ds(), max.adjustments gives the maximum number of adjustment terms to add to the model when doing AIC term selection. Thanks to Oscar Dewhurst for the suggestion.

Distance 0.9.7
----------------------
# Distance 0.9.7

* summarize_ds_models now will only compare models that are allowed by AIC (all binning and truncation must be the same). Thanks to Carolin Tröger and Eric Rextad for highlighting this issue.
* If there are numerical issues that cause NAs in the Hessian, ds() will not try to run dht() to estimate abundance (as it will fail), instead throws a message and returns only the detection function. Thanks to Steve Ahlswede for bringing this to our attention.

Distance 0.9.6
----------------------
# Distance 0.9.6

* Coefficients are called coefficients (not a mixture of coefficients and parameters) in summary() results
* Added gof_ds() for easy access to goodness of fit testing and q-q plotting
Expand All @@ -143,86 +134,73 @@ Distance 0.9.6
* Added amakihi (point transect) data
* add extra documentation for objects in obs.table, thanks to Olivier Devineau for spotting this

Distance 0.9.5
----------------------
# Distance 0.9.5

* Truncation by percentage now works when there are missing distances (i.e. when we are using flatfile). Thanks to Len Thomas for pointing out this bug.

Distance 0.9.4
----------------------
# Distance 0.9.4

* Object ID uniqueness stopped abundance estimation from working (since NA IDs were "not unique").
* Check that areas are consistently entered. This was problematic when areas were not entered identically for each region, but unique was used to extract the region table. Thanks to Katy Echave for finding this bug!
* Monotonicity constraints were not applied during automated model selection. Thanks to Tiago Marques for spotting this.
* AIC selection of adjustment terms goes up to 5 terms by default, as in DISTANCE. Thanks to Eric Rexstad for suggesting this.

Distance 0.9.3
----------------------
# Distance 0.9.3

* Updated tests to work with new unique object ID code.
* Liberally sprinkled tests with suppressMessages()

Distance 0.9.2
----------------------
# Distance 0.9.2

* Now warning when columns are correctly named but not in the correct case. Thanks to Richard Borthwick for reporting this bug.
* Now checks that object IDs are unique. Thanks to Ricardo Lima & Francisco Azevedo for highlighting this issue.

Distance 0.9.1
----------------------
# Distance 0.9.1

* Models with both covariates and adjustment terms can actually be specified -- this was not fully implemented in previous version.
* ds() now tells the user the models which is returned (rather than previously fitted model)
* links to mrds documentation on optimisation issues

Distance 0.9
----------------------
# Distance 0.9

* Flat file support example, see ?flatfile
* New data set: simulated minke whale data, see ?minke and ?flatfile for an example analysis
* Models with both covariates and adjustment terms can be specified.
* Default left truncation is now 0, default right truncation is now the largest observed distance or furthest bin end.

Distance 0.8.1
----------------------
# Distance 0.8.1

* another fix to binning (redundant code/inconsistent definition between docs and code). (Thanks to Jason Roberts for finding this.)
* binning would fail if there were NA distances, which might occur when using the simplified data tables
* check implemented to ensure that samples have consistent (i.e. the same) effort (Eric Rexstad found this bug)
* clarification that stratification only occurs at the abundance/density estimation stage (dht), rather than at the detection function modelling stage (thanks to Filipe Dias for this suggestion)
* Setting order=0 is equivalent to adjustment=NULL to specify a detection function without adjustments. (Eric Rexstad brought this to my attention.)

Distance 0.8.0
----------------------
# Distance 0.8.0

* new simplified table data format (see ?ds)
* bug in binning from cutpoints (thanks to Colin Beale for finding this)
* removed percentage truncation for binned data, as it doesn't really make sense

Distance 0.7.4
----------------------
# Distance 0.7.4

* new initial values argument

Distance 0.7.3
----------------------
# Distance 0.7.3

* remove annoying crash when mrds failed to fit a model
* NB the optimiser underlying mrds (optimx) has changed, update both of these packages to avoid issues.

Distance 0.7.2
----------------------
# Distance 0.7.2

* message tells the user the model that was selected

Distance 0.7.1
----------------------
# Distance 0.7.1

* debugging options
* bug fixes (see github for further details)
* automatic generation of adjustments did not generate any for poly/herm.

Distance 0.7
----------------------
# Distance 0.7

* "width" is now default for scaling
2 changes: 0 additions & 2 deletions R/p_dist_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#' @note This function is located in the `mrds` package but the documentation
#' is provided here for easy access.
#' @examples
#' \dontrun{
#' # example using a model for the minke data
#' data(minke)
#' # fit a model
Expand All @@ -18,6 +17,5 @@
#' p_dist_table(result)
#' # with proportions
#' p_dist_table(result, proportion=TRUE)
#' }
NULL

2 changes: 1 addition & 1 deletion R/print.dht_result.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ print.dht_result <- function(x, report="abundance", groups=FALSE, ...){
"none",
paste(attr(x, "multipliers"), collapse=", ")),
"\n")
cat("Sample fraction :" , ifelse(attr(x, "sample_fraction")>1,
cat("Sample fraction :" , ifelse(is.data.frame(attr(x, "sample_fraction")),
"multiple", attr(x, "sample_fraction")), "\n")

cat("\n\n")
Expand Down
9 changes: 5 additions & 4 deletions R/summarize_ds_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
#' model_hr <- ds(tee.data,4, key="hr")
#' summarize_ds_models(model_hr, model_hn, output="plain")
#'}
summarize_ds_models <- function(..., sort="AIC", output="latex",
delta_only=TRUE){
summarize_ds_models <- function(..., sort="AIC", output="latex", delta_only=TRUE){

# get the models
models <- list(...)
Expand Down Expand Up @@ -71,9 +70,11 @@ summarize_ds_models <- function(..., sort="AIC", output="latex",
extract_model_data <- function(model){
summ <- summary(model)

# handle (uniform) no formula case
# handle (uniform) no formula / no average.p.se case
formula <- model$ddf$ds$aux$ddfobj$scale$formula
if(is.null(formula)) formula <- NA
average.p.se <- summ$ds$average.p.se
if(is.null(average.p.se)) average.p.se <- NA

desc <- gsub(" key function","",model.description(model$ddf))
# only get CvM if not binned
Expand All @@ -86,7 +87,7 @@ summarize_ds_models <- function(..., sort="AIC", output="latex",
formula,
gof,
summ$ds$average.p,
summ$ds$average.p.se,
average.p.se,
model$ddf$criterion
)
return(ret)
Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
`Distance`
==========
Distance: analysis of distance sampling data

[![R-CMD-check](https://github.com/DistanceDevelopment/Distance/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/DistanceDevelopment/Distance/actions/workflows/check-standard.yaml)
[![CRAN (RStudio Mirror) Downloads](http://cranlogs.r-pkg.org/badges/Distance)](https://www.r-pkg.org/pkg/Distance)
Expand All @@ -10,19 +9,22 @@

# Using `Distance`

For more information and examples of use [take a look at this paper](https://www.jstatsoft.org/article/view/v089i01) published in Journal of Statistical Software in May 2019.
### Distance **R** package preferred citation
- Miller, D. L., Rexstad, E., Thomas, L., Marshall, L., & Laake, J. L. (2019). Distance Sampling in R. Journal of Statistical Software, 89(1), 1–28. DOI: [10.18637/jss.v089.i01](https://doi.org/10.18637/jss.v089.i01)

We also maintain a set of example analyses at [examples.distancesampling.org](http://examples.distancesampling.org).
Consult the [Articles](https://distancesampling.org/resources/vignettes.html) for case studies of distance sampling analyses.

# Getting `Distance`

The easiest way to ensure you have the latest version of `Distance`, is to install Hadley Wickham's `devtools` package:
The easiest way to ensure you have the latest version of `Distance`, is to install `devtools`:

install.packages("devtools")

then install `Distance` from github:

library(devtools)
install_github("DistanceDevelopment/Distance")
```{r}
install.packages("devtools")
```

then install `Distance` from Github:

```{r}
library(devtools)
install_github("DistanceDevelopment/Distance")
```
Loading
Loading