Skip to content

Commit

Permalink
Release to CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
mdenwood committed Mar 3, 2021
1 parent 5f835c5 commit 03a4f7f
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 108 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ NAMESPACE_RG2
notebooks
reports
extra_tests
releases
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Suggests:
modeest,
testthat (>= 3.0.0),
knitr,
rmarkdown,
markdown,
spelling
Config/testthat/edition: 3
VignetteBuilder: knitr
Expand Down
209 changes: 107 additions & 102 deletions README → INSTALL
Original file line number Diff line number Diff line change
@@ -1,102 +1,107 @@
######################################################################################################
###
### runjags package
### Matthew Denwood, 2nd October 2015
###
### Installation from source - help and tips
###
### The instructions below are modified from the rjags package
### Original file is Copyright (C) Martyn Plummer, licensed under GPL-2
###
######################################################################################################


The runjags package itself is entirely written in R, but it does contain
a JAGS module that provides additional distributions that must be
compiled for your system against a functional JAGS installation. See
the platform specific instructions below for how to do this.

If you are unable to compile the C++ code and don't require the distributions
provided in the JAGS extension module, see the 'Compile-free' instructions
at the end of this document.



Windows
-------

At compile time, there is no way for Windows to guess where the JAGS
library is installed, so you must supply the location yourself using
the make variable JAGS_ROOT, defining it in the file HOME/.R/Makevars.win
like so:

JAGS_ROOT=c:\Program Files\JAGS\JAGS-3.3.0

The configure script also needs to know the version of JAGS being used,
and will attempt to guess this from the JAGS_ROOT path. If a non-
standard install path has been used you will need to provide the correct
JAGS major-version number like so:

JAGS_MAJOR_VERSION=3

The header files for the module itself should be able to detect the
version of JAGS installed on your system, but if you encounter compiler
errors it may help to specify JAGS_MAJOR_VERSION even if JAGS is
installed in a standard directory - e.g. JAGS 4-beta requires:

JAGS_MAJOR_VERSION=4



Unix (including Mac OS X)
-------------------------

The configure script will try to guess the location of the JAGS
library installation. It will look in /<prefix>/<lib>, where

- <prefix> is the determined from the location of the jags
script that launches the command line interface.

For example, if this is "/usr/local/bin/jags", then prefix will
be "/usr/local"

- <lib> is derived from the value of "LIBnn", returned by
"R CMD config LIBnn".

This is particularly important on 64-bit unix, where R is
installed by default in /usr/local/lib64 and LIBnn is "lib64"

The configure script will also look for JAGS headers in
/<prefix>/include/JAGS

If the configure script fails to find the JAGS headers or library,
you can set the environment variables JAGS_INCLUDE and JAGS_LIB
to point to the correct directory.

The header files for the module itself should be able to detect the
version of JAGS installed on your system, but a JAGS_MAJOR_VERSION
environmental variable can be set in case of problems which may be
encountered with some versions of JAGS - e.g. JAGS 4-beta requires:

export JAGS_MAJOR_VERSION=4
R CMD install runjags...



Compile-free
------------

The standard version of the runjags package includes a JAGS
extension module providing additional distributions in the Pareto
family (amongst others).

If you want to install runjags without the additional JAGS module,
then you can simply remove the configure(.ac) files and entire src
directory before running R CMD install runjags... This does not
require any C++ compilers, or even for JAGS to be installed on
your system.

Alternatively there is a version of runjags with the JAGS module
removed hosted on the sourceforge page for runjags at:
http://sourceforge.net/projects/runjags/).

######################################################################################################
###
### Installation instructions for the runjags package
### Matthew Denwood, 27th February 2021
###
### The instructions below are modified from the rjags package
### Original file is Copyright (C) Martyn Plummer, licensed under GPL-2
###
######################################################################################################


The runjags package itself is entirely written in R, but it does contain
a JAGS module that provides additional distributions that must be
compiled for your system against a functional JAGS installation. See
the platform specific instructions below for how to do this.

If you are unable to compile the C++ code and don't require the distributions
provided in the JAGS extension module, see the 'Compile-free' instructions
at the end of this document.



Installation on Windows
-----------------------

At compile time, there is no way for Windows to guess where the JAGS
library is installed, so you must supply the location yourself using
the make variable JAGS_ROOT, defining it in the file HOME/.R/Makevars.win
like so:

JAGS_ROOT=c:/Progra~1/JAGS/JAGS-4.0.0

where HOME is the default starting directory for an R session launched
from the start menu (typically your Documents folder).

The configure script also needs to know the version of JAGS being used,
and will attempt to guess this from the JAGS_ROOT path. If a non-
standard install path has been used you will need to provide the correct
JAGS major-version number like so:

JAGS_MAJOR_VERSION=4

The header files for the module itself should be able to detect the
version of JAGS installed on your system, but if you encounter compiler
errors it may help to specify JAGS_MAJOR_VERSION even if JAGS is
installed in a standard directory.



Unix/Linux: pkg-config
------------------------

If you have pkg-config installed then the configure script will use it
to detect the JAGS library and set the compiler and linker flags for
runjags. You can test this capability in a unix shell by typing

pkg-config --modversion jags

If this does not detect your JAGS installation then it means that the
file 'jags.pc' is not on the search path of pkg-config. In this case
you should add it by setting the environment variable PKG_CONFIG_PATH.
For example if the full path to 'jags.pc' is
'/usr/local/lib64/pkgconfig/jags.pc', then set

export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig

before installing runjags.

Recall that most Linux distributions divide software into `user' and
`developer' versions, so if you are using a pre-built JAGS binary
package for your Linux distribution then remember to install the
developer version before attempting to install the runjags package.

The header files for the module itself should be able to detect the
version of JAGS installed on your system, but a JAGS_MAJOR_VERSION
environmental variable can be set in case of problems which may be
encountered with some versions of JAGS - e.g. JAGS 4-beta requires:

export JAGS_MAJOR_VERSION=4
R CMD install runjags



Unix/Linux: legacy configuration
----------------------------------

Legacy configuration is used whenever pkg-config is not installed or
otherwise fails to detect the JAGS library. Legacy configuration is
deprecated and will be removed in a future version. If you experience
problems with installing runjags then it is strongly recommended that
you try to get pkg-config working. Otherwise, you can refer to the
legacy installation instructions given within the rjags package.



Compile-free
------------

The standard version of the runjags package includes a JAGS
extension module providing additional distributions in the Pareto
family (amongst others).

If you want to install runjags without the additional JAGS module,
then you can simply remove the configure(.ac) files and entire src
directory before running R CMD install runjags. This does not
require any C++ compilers, or even for JAGS to be installed on
your system.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ write.jagsfile,
write.JAGSfile,
template.jags,
template.JAGS,
template_huiwalter,

extract.runjags,
extract,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE_OLD
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ write.jagsfile,
write.JAGSfile,
template.jags,
template.JAGS,
template_huiwalter,

extract.runjags,
extract,
Expand Down
7 changes: 4 additions & 3 deletions R/template_huiwalter.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
#'
#' @param testdata the input paired test data, where each column name corresponds to a test result - except possibly "ID" which is ignored, and "Population" indicating a population identifier for that row. Each row must represent test results from the same individual either as logical or a factor with two levels (and where the first level indicates a negative test result). Data may be missing at random (except for Population).
#' @param outfile the name of the text file to save the model representation
#' @param covon should covariance terms be activated or omitted?
#' @param covariance should covariance terms be activated or omitted?
#' @param se_priors the priors to use for sensitivity parameters (can be adjusted in the model once it is generated)
#' @param sp_priors the priors to use for specificity parameters (can be adjusted in the model once it is generated)
#'
#' @export
template_huiwalter <- function(testdata, outfile='huiwalter_model.txt', covon=FALSE, se_priors='dbeta(1,1)', sp_priors='dbeta(1,1)'){
template_huiwalter <- function(testdata, outfile='huiwalter_model.txt', covariance=FALSE, se_priors='dbeta(1,1)', sp_priors='dbeta(1,1)'){

stopifnot(is.data.frame(testdata))
covon <- covariance

## R code to generate a Hui-Walter model for N tests and P populations, with potential missing data

Expand All @@ -36,7 +37,7 @@ template_huiwalter <- function(testdata, outfile='huiwalter_model.txt', covon=FA
npop <- length(levels(testdata$Population))

## Initialise the file:
cat('## Auto-generated Hui-Walter model created by script version ', version, ' on ', as.character(Sys.Date()), '\n\nmodel{\n\n\t## Observation layer:', sep='', file=outfile, append=FALSE)
cat('## Auto-generated Hui-Walter model created by runjags version ', runjagsprivate$runjagsversion, ' on ', as.character(Sys.Date()), '\n\nmodel{\n\n\t## Observation layer:', sep='', file=outfile, append=FALSE)

## Some variables that are needed in a few places:
testcols <- names(testdata)[!names(testdata) %in% c('ID','Population')]
Expand Down
4 changes: 2 additions & 2 deletions man/template_huiwalter.Rd

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

Binary file added releases/runjags_2.2.0-2.tar.gz
Binary file not shown.

0 comments on commit 03a4f7f

Please sign in to comment.