statnet.common/ 0000755 0001762 0000144 00000000000 14433433333 013226 5 ustar ligges users statnet.common/NAMESPACE 0000644 0001762 0000144 00000007217 14427313311 014450 0 ustar ligges users # Generated by roxygen2: do not edit by hand
S3method("$",control.list)
S3method("[",term_list)
S3method("[",wmatrix)
S3method("[<-",wmatrix)
S3method("lrowweights<-",linwmatrix)
S3method("lrowweights<-",logwmatrix)
S3method("lrowweights<-",matrix)
S3method("rowweights<-",linwmatrix)
S3method("rowweights<-",logwmatrix)
S3method("rowweights<-",matrix)
S3method(as.control.list,control.list)
S3method(as.control.list,list)
S3method(as.linwmatrix,linwmatrix)
S3method(as.linwmatrix,logwmatrix)
S3method(as.linwmatrix,matrix)
S3method(as.logwmatrix,linwmatrix)
S3method(as.logwmatrix,logwmatrix)
S3method(as.logwmatrix,matrix)
S3method(as.term_list,default)
S3method(as.term_list,term_list)
S3method(c,term_list)
S3method(compress_rows,data.frame)
S3method(compress_rows,linwmatrix)
S3method(compress_rows,logwmatrix)
S3method(decompress_rows,compressed_rows_df)
S3method(decompress_rows,wmatrix)
S3method(diff,control.list)
S3method(lrowweights,linwmatrix)
S3method(lrowweights,logwmatrix)
S3method(order,data.frame)
S3method(order,default)
S3method(order,matrix)
S3method(print,control.list)
S3method(print,diff.control.list)
S3method(print,linwmatrix)
S3method(print,logwmatrix)
S3method(print,term_list)
S3method(print,wmatrix)
S3method(rowweights,linwmatrix)
S3method(rowweights,logwmatrix)
S3method(sort,data.frame)
S3method(split,array)
S3method(split,matrix)
S3method(trim_env,default)
S3method(trim_env,environment)
S3method(update,Welford)
export("EVL<-")
export("NVL<-")
export("lrowweights<-")
export("rowweights<-")
export("ult<-")
export(.Deprecate_method)
export(.Deprecate_once)
export(COLLATE_ALL_MY_CONTROLS_EXPR)
export(ERRVL)
export(EVL)
export(EVL2)
export(EVL3)
export(NVL)
export(NVL2)
export(NVL3)
export(UPDATE_MY_SCTRL_EXPR)
export(Welford)
export(all_identical)
export(append.rhs.formula)
export(append_rhs.formula)
export(as.control.list)
export(as.linwmatrix)
export(as.logwmatrix)
export(as.term_list)
export(attr)
export(base_env)
export(check.control.class)
export(colMeans.mcmc.list)
export(collate_controls)
export(compress_rows)
export(control.remap)
export(deInf)
export(decompress_rows)
export(default_options)
export(despace)
export(empty_env)
export(eval_lhs.formula)
export(filter_rhs.formula)
export(fixed.pval)
export(forkTimeout)
export(handle.controls)
export(is.SPD)
export(is.linwmatrix)
export(is.logwmatrix)
export(is.wmatrix)
export(lapply.mcmc.list)
export(linwmatrix)
export(list_rhs.formula)
export(list_summands.call)
export(locate_function)
export(locate_prefixed_function)
export(log_mean_exp)
export(log_sum_exp)
export(logwmatrix)
export(lrowweights)
export(lweighted.cov)
export(lweighted.mean)
export(lweighted.var)
export(message_print)
export(nonsimp.update.formula)
export(nonsimp_update.formula)
export(once)
export(opttest)
export(order)
export(paste.and)
export(persistEval)
export(persistEvalQ)
export(rowweights)
export(sandwich_solve)
export(sandwich_ssolve)
export(set.control.class)
export(sginv)
export(simplify_simple)
export(snctrl)
export(snctrl_names)
export(snearPD)
export(srcond)
export(ssolve)
export(statnet.cite.foot)
export(statnet.cite.head)
export(statnet.cite.pkg)
export(statnetStartupMessage)
export(sweep.mcmc.list)
export(sweep_cols.matrix)
export(term.list.formula)
export(term_list)
export(trim_env)
export(ult)
export(unused_dots_warning)
export(unwhich)
export(update_snctrl)
export(vector.namesmatch)
export(xAxT)
export(xTAx)
export(xTAx_qrsolve)
export(xTAx_qrssolve)
export(xTAx_solve)
export(xTAx_ssolve)
importFrom(coda,as.mcmc)
importFrom(coda,as.mcmc.list)
importFrom(methods,is)
importFrom(stats,as.formula)
importFrom(utils,capture.output)
importFrom(utils,getAnywhere)
importFrom(utils,modifyList)
useDynLib(statnet.common)
statnet.common/LICENSE 0000644 0001762 0000144 00000003113 14364112224 014225 0 ustar ligges users --------------------------------------------------
License for the 'statnet' component package 'statnet.common'
--------------------------------------------------
This software is distributed under the GPL-3 license. It is free,
open source, and has the following attribution requirements
(GPL Section 7):
(a) you agree to retain in 'statnet.common' and any modifications to 'statnet.common'
the copyright, author attribution and URL information as
provided at http://statnet.org/attribution
(b) you agree that 'statnet.common' and any modifications to 'statnet.common' will,
when used, display the attribution:
Based on 'statnet' project software (http://statnet.org).
For license and citation information see http://statnet.org/attribution
--------------------------------------------------
What does this mean?
====================
If you are modifying 'statnet.common' or adopting any source code from
'statnet.common' for use in another application, you must ensure that the
copyright and attributions mentioned in the license above appear
in the code of your modified version or application. These
attributions must also appear when the package is loaded
(e.g., via 'library' or 'require').
Enjoy!
Mark S. Handcock, University of California - Los Angeles
David R. Hunter, Penn State University
Carter T. Butts, University of California - Irvine
Steven M. Goodreau, University of Washington
Pavel N. Krivitsky, University of New South Wales
Michał Bojanowski, Kozminski University
Martina Morris, University of Washington
The 'statnet' development team
Copyright 2007-2023
statnet.common/man/ 0000755 0001762 0000144 00000000000 14427313310 013774 5 ustar ligges users statnet.common/man/vector.namesmatch.Rd 0000644 0001762 0000144 00000002126 13416034725 017714 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{vector.namesmatch}
\alias{vector.namesmatch}
\title{reorder vector v into order determined by matching the names of its elements
to a vector of names}
\usage{
vector.namesmatch(v, names, errname = NULL)
}
\arguments{
\item{v}{a vector (or list) with named elements, to be reorderd}
\item{names}{a character vector of element names, corresponding to names of
\code{v}, specificying desired orering of \code{v}}
\item{errname}{optional, name to be reported in any error messages. default
to \code{deparse(substitute(v))}}
}
\value{
returns \code{v}, with elements reordered
}
\description{
A helper function to reorder vector \code{v} (if named) into order specified
by matching its names to the argument \code{names}
}
\details{
does some checking of appropriateness of arguments, and reorders v by
matching its names to character vector \code{names}
}
\note{
earlier versions of this function did not order as advertiased
}
\examples{
test<-list(c=1,b=2,a=3)
vector.namesmatch(test,names=c('a','c','b'))
}
statnet.common/man/handle.controls.Rd 0000644 0001762 0000144 00000003242 14050632700 017360 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/control.utilities.R
\name{handle.controls}
\alias{handle.controls}
\title{Handle standard \verb{control.*()} function semantics.}
\usage{
handle.controls(myname, ...)
}
\arguments{
\item{myname}{the name of the calling function.}
\item{...}{the \code{...} argument of the control function, if present.}
}
\value{
a list with formal arguments of the calling function.
}
\description{
This function takes the arguments of its caller (whose name should
be passed explicitly), plus any \code{...} arguments and produces a
control list based on the standard semantics of \verb{control.*()}
functions, including handling deprecated arguments, identifying
undefined arguments, and handling arguments that should be passed
through \code{\link[=match.arg]{match.arg()}}.
}
\details{
The function behaves based on the information it acquires from the calling function. Specifically,
\itemize{
\item The values of formal arguments (except \code{...}, if present) are
taken from the environment of the calling function and stored in
the list.
\item If the calling function has a \code{...} argument \emph{and} defines an
\code{old.controls} variable in its environment, then it remaps the
names in \code{...} to their new names based on \code{old.controls}. In
addition, if the value is a list with two elements, \code{action} and
\code{message}, the standard deprecation message will have \code{message}
appended to it and then be called with \code{action()}.
\item If the calling function has a \code{match.arg.pars} in its
environment, the arguments in that list are processed through
\code{\link[=match.arg]{match.arg()}}.
}
}
statnet.common/man/sweep_cols.matrix.Rd 0000644 0001762 0000144 00000001574 13416034725 017747 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logspace.utils.R
\name{sweep_cols.matrix}
\alias{sweep_cols.matrix}
\title{Suptract a elements of a vector from respective columns of a matrix}
\usage{
sweep_cols.matrix(x, STATS, disable_checks = FALSE)
}
\arguments{
\item{x}{a numeric matrix;}
\item{STATS}{a numeric vector whose length equals to the number of columns
of \code{x}.}
\item{disable_checks}{if \code{TRUE}, do not check that \code{x} is a
numeric matrix and its number of columns matches the length of \code{STATS};
set in production code for a significant speed-up.}
}
\value{
A matrix of the same attributes as \code{x}.
}
\description{
An optimized function equivalent to \code{sweep(x, 2, STATS)} for a matrix
\code{x}.
}
\examples{
x <- matrix(runif(1000), ncol=4)
s <- 1:4
stopifnot(all.equal(sweep_cols.matrix(x, s), sweep(x, 2, s)))
}
statnet.common/man/set.control.class.Rd 0000644 0001762 0000144 00000001737 13622373301 017653 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/control.utilities.R
\name{set.control.class}
\alias{set.control.class}
\title{Set the class of the control list}
\usage{
set.control.class(
myname = as.character(ult(sys.calls(), 2)[[1L]]),
control = get("control", pos = parent.frame())
)
}
\arguments{
\item{myname}{Name of the class to set.}
\item{control}{Control list. Defaults to the \code{control} variable in the
calling function.}
}
\value{
The control list with class set.
}
\description{
This function sets the class of the control list, with the default being the
name of the calling function.
}
\note{
In earlier versions, \code{OKnames} and \code{myname} were autodetected. This capability has been deprecated and results in a warning issued once per session. They now need to be set explicitly.
}
\seealso{
\code{\link[=check.control.class]{check.control.class()}}, \code{\link[=print.control.list]{print.control.list()}}
}
\keyword{utilities}
statnet.common/man/empty_env.Rd 0000644 0001762 0000144 00000001440 14014171552 016272 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/formula.utilities.R
\name{empty_env}
\alias{empty_env}
\alias{base_env}
\title{Replace an object's environment with a simple, static environment.}
\usage{
empty_env(object)
base_env(object)
}
\arguments{
\item{object}{An object with the \verb{environment()<-} method.}
}
\value{
An object of the same type as \code{object}, with updated environment.
}
\description{
Replace an object's environment with a simple, static environment.
}
\examples{
f <- y~x
environment(f) # GlobalEnv
environment(empty_env(f)) # EmptyEnv
\dontshow{
stopifnot(identical(environment(empty_env(f)), emptyenv()))
}
environment(base_env(f)) # base package environment
\dontshow{
stopifnot(identical(environment(base_env(f)), baseenv()))
}
}
statnet.common/man/wmatrix.Rd 0000644 0001762 0000144 00000007261 13727604572 016003 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wmatrix.R
\name{wmatrix}
\alias{wmatrix}
\alias{logwmatrix}
\alias{linwmatrix}
\alias{is.wmatrix}
\alias{is.logwmatrix}
\alias{is.linwmatrix}
\alias{as.linwmatrix}
\alias{as.logwmatrix}
\alias{as.linwmatrix.linwmatrix}
\alias{as.linwmatrix.logwmatrix}
\alias{as.logwmatrix.logwmatrix}
\alias{as.logwmatrix.linwmatrix}
\alias{as.linwmatrix.matrix}
\alias{as.logwmatrix.matrix}
\alias{print.wmatrix}
\alias{print.logwmatrix}
\alias{print.linwmatrix}
\alias{compress_rows.logwmatrix}
\alias{compress_rows.linwmatrix}
\alias{decompress_rows.wmatrix}
\alias{[.wmatrix}
\alias{[<-.wmatrix}
\title{A data matrix with row weights}
\usage{
logwmatrix(
data = NA,
nrow = 1,
ncol = 1,
byrow = FALSE,
dimnames = NULL,
w = NULL
)
linwmatrix(
data = NA,
nrow = 1,
ncol = 1,
byrow = FALSE,
dimnames = NULL,
w = NULL
)
is.wmatrix(x)
is.logwmatrix(x)
is.linwmatrix(x)
as.linwmatrix(x, ...)
as.logwmatrix(x, ...)
\method{as.linwmatrix}{linwmatrix}(x, ...)
\method{as.linwmatrix}{logwmatrix}(x, ...)
\method{as.logwmatrix}{logwmatrix}(x, ...)
\method{as.logwmatrix}{linwmatrix}(x, ...)
\method{as.linwmatrix}{matrix}(x, w = NULL, ...)
\method{as.logwmatrix}{matrix}(x, w = NULL, ...)
\method{print}{wmatrix}(x, ...)
\method{print}{logwmatrix}(x, ...)
\method{print}{linwmatrix}(x, ...)
\method{compress_rows}{logwmatrix}(x, ...)
\method{compress_rows}{linwmatrix}(x, ...)
\method{decompress_rows}{wmatrix}(x, target.nrows = NULL, ...)
\method{[}{wmatrix}(x, i, j, ..., drop = FALSE)
\method{[}{wmatrix}(x, i, j, ...) <- value
}
\arguments{
\item{data, nrow, ncol, byrow, dimnames}{passed to \code{\link{matrix}}.}
\item{w}{row weights on the appropriate scale.}
\item{x}{an object to be coerced or tested.}
\item{...}{extra arguments, currently unused.}
\item{target.nrows}{the approximate number of rows the uncompressed matrix
should have; if not achievable exactly while respecting proportionality, a
matrix with a slightly different number of rows will be constructed.}
\item{i, j, value}{rows and columns and values for extraction or
replacement; as \code{\link{matrix}}.}
\item{drop}{Used for consistency with the generic. Ignored, and
always treated as \code{FALSE}.}
}
\value{
An object of class \code{linwmatrix}/\code{logwmatrix} and \code{wmatrix},
which is a \code{\link{matrix}} but also has an attribute \code{w} containing
row weights on the linear or the natural-log-transformed scale.
}
\description{
A representation of a numeric matrix with row weights, represented
on either linear (\code{linwmatrix}) or logarithmic (\code{logwmatrix})
scale.
}
\note{
Note that \code{wmatrix} itself is an "abstract" class: you cannot
instantiate it.
Note that at this time, \code{wmatrix} is designed as, first and
foremost, as class for storing compressed data matrices, so most
methods that operate on matrices may not handle the weights
correctly and may even cause them to be lost.
}
\examples{
(m <- matrix(1:3, 2, 3, byrow=TRUE))
(m <- rbind(m, 3*m, 2*m, m))
(mlog <- as.logwmatrix(m))
(mlin <- as.linwmatrix(m))
(cmlog <- compress_rows(mlog))
(cmlin <- compress_rows(mlin))
stopifnot(all.equal(as.linwmatrix(cmlog),cmlin))
cmlog[2,] <- 1:3
(cmlog <- compress_rows(cmlog))
stopifnot(sum(rowweights(cmlog))==nrow(m))
(m3 <- matrix(c(1:3,(1:3)*2,(1:3)*3), 3, 3, byrow=TRUE))
(rowweights(m3) <- c(4, 2, 2))
stopifnot(all.equal(compress_rows(as.logwmatrix(m)), as.logwmatrix(m3),check.attributes=FALSE))
stopifnot(all.equal(rowweights(compress_rows(as.logwmatrix(m))),
rowweights(as.logwmatrix(m3)),check.attributes=FALSE))
}
\seealso{
\code{\link{rowweights}}, \code{\link{lrowweights}}, \code{\link{compress_rows}}
}
statnet.common/man/forkTimeout.Rd 0000644 0001762 0000144 00000003626 13577042065 016615 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{forkTimeout}
\alias{forkTimeout}
\title{Evaluate an \R expression with a hard time limit by forking a process}
\usage{
forkTimeout(
expr,
timeout,
unsupported = c("warning", "error", "message", "silent"),
onTimeout = NULL
)
}
\arguments{
\item{expr}{expression to be evaluated.}
\item{timeout}{number of seconds to wait for the expression to
evaluate.}
\item{unsupported}{a character vector of length 1 specifying how to
handle a platform that does not support
#ifndef windows
\code{\link[parallel:mcparallel]{parallel::mcparallel()}},
#endif
#ifdef windows
\code{parallel::mcparallel()},
#endif
\describe{
\item{\code{"warning"} or \code{"message"}}{Issue a warning or a message,
respectively, then evaluate the expression without the time limit
enforced.}
\item{\code{"error"}}{Stop with an error.}
\item{\code{"silent"}}{Evaluate the expression without the time limit
enforced, without any notice.}
} Partial matching is used.}
\item{onTimeout}{Value to be returned on time-out.}
}
\value{
Result of evaluating \code{expr} if completed, \code{onTimeout}
otherwise.
}
\description{
This function uses
#ifndef windows
\code{\link[parallel:mcparallel]{parallel::mcparallel()}},
#endif
#ifdef windows
\code{parallel::mcparallel()},
#endif
so the time limit is not
enforced on Windows. However, unlike functions using \code{\link[=setTimeLimit]{setTimeLimit()}}, the time
limit is enforced even on native code.
}
\note{
\code{onTimeout} can itself be an expression, so it is, for
example, possible to stop with an error by passing
\code{onTimeout=stop()}.
Note that this function is not completely transparent:
side-effects may behave in unexpected ways. In particular, RNG
state will not be updated.
}
\examples{
forkTimeout({Sys.sleep(1); TRUE}, 2) # TRUE
forkTimeout({Sys.sleep(1); TRUE}, 0.5) # NULL (except on Windows)
}
statnet.common/man/snctrl.Rd 0000644 0001762 0000144 00000002100 14264770641 015576 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/control.utilities.R
\name{snctrl}
\alias{snctrl}
\title{Statnet Control}
\usage{
snctrl(...)
}
\arguments{
\item{...}{The parameter list is updated dynamically as packages
are loaded and unloaded. Their current list is given below.}
}
\description{
A utility to facilitate argument completion of control lists.
}
\details{
In and of itself, \code{snctrl} copies its named arguments into a
list. However, its argument list is updated dynamically as packages
are loaded, as are those of its reexports from other packages. This
is done using an API provided by helper functions. (See \code{API?snctrl}.)
}
\note{
You may see messages along the lines of
\if{html}{\out{
}}\preformatted{The following object is masked from 'package:PKG':
snctrl
}\if{html}{\out{
}}
when loading packages. They are benign.
}
\section{Currently recognised control parameters}{
This list is updated as packages are loaded and unloaded.
\Sexpr[results=rd,stage=render]{statnet.common::snctrl_names()}
}
statnet.common/man/is.SPD.Rd 0000644 0001762 0000144 00000000700 14427313307 015326 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/matrix.utils.R
\name{is.SPD}
\alias{is.SPD}
\title{Test if the object is a matrix that is symmetric and positive definite}
\usage{
is.SPD(x, tol = .Machine$double.eps)
}
\arguments{
\item{x}{the object to be tested.}
\item{tol}{the tolerance for the reciprocal condition number.}
}
\description{
Test if the object is a matrix that is symmetric and positive definite
}
statnet.common/man/attr.Rd 0000644 0001762 0000144 00000001135 14054035110 015230 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{attr}
\alias{attr}
\title{A wrapper for base::attr which defaults to exact matching.}
\usage{
attr(x, which, exact = TRUE)
}
\arguments{
\item{x, which, exact}{as in \code{base::attr}, but with \code{exact}
defaulting to \code{TRUE} in this implementation}
}
\value{
as in \code{base::attr}
}
\description{
A wrapper for base::attr which defaults to exact matching.
}
\examples{
x <- list()
attr(x, "name") <- 10
base::attr(x, "n")
stopifnot(is.null(attr(x, "n")))
base::attr(x, "n", exact = TRUE)
}
statnet.common/man/snctrl-API.Rd 0000644 0001762 0000144 00000005623 14306106355 016212 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/control.utilities.R
\docType{data}
\name{snctrl_names}
\alias{snctrl_names}
\alias{snctrl-API}
\alias{update_snctrl}
\alias{collate_controls}
\alias{UPDATE_MY_SCTRL_EXPR}
\alias{COLLATE_ALL_MY_CONTROLS_EXPR}
\title{Helper functions used by packages to facilitate \code{\link{snctrl}} updating.}
\format{
\code{UPDATE_MY_SCTRL_EXPR} is a quoted expression meant to be passed directly to \code{\link[=eval]{eval()}}.
\code{COLLATE_ALL_MY_CONTROLS_EXPR} is a quoted expression meant to be passed directly to \code{\link[=eval]{eval()}}.
}
\usage{
snctrl_names()
update_snctrl(myname, arglists = NULL, callback = NULL)
collate_controls(x = NULL, ...)
UPDATE_MY_SCTRL_EXPR
COLLATE_ALL_MY_CONTROLS_EXPR
}
\arguments{
\item{myname}{Name of the package defining the arguments.}
\item{arglists}{A named list of argument name-default pairs. If the
list is not named, it is first passed through
\code{\link[=collate_controls]{collate_controls()}}.}
\item{callback}{A function with no arguments that updates the
packages own copy of \code{\link[=snctrl]{snctrl()}}.}
\item{x}{Either a function, a list of functions, or an
environment. If \code{x} is an environment, all functions starting
with dQuote(\code{control.}) are obtained.}
\item{...}{Additional functions or lists of functions.}
}
\value{
\code{update_snctrl()} has no return value and is used for its side-effects.
\code{collate_controls()} returns the combined list of name-default pairs of each function.
}
\description{
Helper functions used by packages to facilitate \code{\link{snctrl}} updating.
}
\section{Functions}{
\itemize{
\item \code{snctrl_names()}: Typeset the currently defined list of
argument names by package and control function.
\item \code{update_snctrl()}: Typically called from \code{\link[=.onLoad]{.onLoad()}}, Update the
argument list of \code{\link[=snctrl]{snctrl()}} to include additional argument names
associated with the package, and set a callback for the package
to update its own copy.
\item \code{collate_controls()}: Obtain and concatenate the argument lists of
specified functions or all functions starting with dQuote(\code{control.}) in
the environment.
\item \code{UPDATE_MY_SCTRL_EXPR}: A stored expression that, if evaluated, will
create a callback function \code{update_my_snctrl()} that will update
the client package's copy of \code{\link[=snctrl]{snctrl()}}.
\item \code{COLLATE_ALL_MY_CONTROLS_EXPR}: A stored expression that, if evaluated on
loading, will add arguments of the package's \verb{control.*()}
functions to \code{\link[=snctrl]{snctrl()}} and set the callback.
}}
\examples{
\dontrun{
# In the client package (outside any function):
eval(UPDATE_MY_SCTRL_EXPR)
}
\dontrun{
# In the client package:
.onLoad <- function(libame, pkgname){
# ... other code ...
eval(statnet.common::COLLATE_ALL_MY_CONTROLS_EXPR)
# ... other code ...
}
}
}
\keyword{datasets}
statnet.common/man/ult.Rd 0000644 0001762 0000144 00000002117 13423722362 015076 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{ult}
\alias{ult}
\alias{ult<-}
\title{Extract or replace the \emph{ult}imate (last) element of a vector or a list, or an element counting from the end.}
\usage{
ult(x, i = 1L)
ult(x, i = 1L) <- value
}
\arguments{
\item{x}{a vector or a list.}
\item{i}{index from the end of the list to extract or replace (where 1 is the last element, 2 is the penultimate element, etc.).}
\item{value}{Replacement value for the \code{i}th element from the end.}
}
\value{
An element of \code{x}.
}
\description{
Extract or replace the \emph{ult}imate (last) element of a vector or a list, or an element counting from the end.
}
\note{
Due to the way in which assigning to a function is
implemented in R, \code{ult(x) <- e} may be less efficient than
\code{x[[length(x)]] <- e}.
}
\examples{
x <- 1:5
(last <- ult(x))
(penultimate <- ult(x, 2)) # 2nd last.
\dontshow{
stopifnot(last==5)
stopifnot(penultimate==4)
}
(ult(x) <- 6)
(ult(x, 2) <- 7) # 2nd last.
x
\dontshow{
stopifnot(all(x == c(1:3, 7L, 6L)))
}
}
statnet.common/man/logspace.utils.Rd 0000644 0001762 0000144 00000006303 14376774271 017245 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logspace.utils.R
\name{logspace.utils}
\alias{logspace.utils}
\alias{log_sum_exp}
\alias{log_mean_exp}
\alias{lweighted.mean}
\alias{lweighted.var}
\alias{lweighted.cov}
\title{Utilities for performing calculations on logarithmic scale.}
\usage{
log_sum_exp(logx, use_ldouble = FALSE)
log_mean_exp(logx, use_ldouble = FALSE)
lweighted.mean(x, logw)
lweighted.var(x, logw)
lweighted.cov(x, y, logw)
}
\arguments{
\item{logx}{Numeric vector of \eqn{\log(x)}, the natural logarithms of the
values to be summed or averaged.}
\item{use_ldouble}{Whether to use \code{long double} precision in the
calculation. If \code{TRUE}, 's C built-in \code{logspace_sum()} is used. If
\code{FALSE}, the package's own implementation based on it is used, using
\code{double} precision, which is (on most systems) several times faster, at
the cost of precision.}
\item{x, y}{Numeric vectors or matrices of \eqn{x} and \eqn{y}, the (raw) values
to be summed, averaged, or whose variances and covariances are to
be calculated.}
\item{logw}{Numeric vector of \eqn{\log(w)}, the natural logarithms of the
weights.}
}
\value{
The functions return the equivalents of the R expressions given below,
but faster and with less loss of precision.
}
\description{
A small suite of functions to compute sums, means, and weighted means on
logarithmic scale, minimizing loss of precision.
}
\section{Functions}{
\itemize{
\item \code{log_sum_exp()}: \code{log(sum(exp(logx)))}
\item \code{log_mean_exp()}: \code{log(mean(exp(logx)))}
\item \code{lweighted.mean()}: weighted mean of \code{x}:
\code{sum(x*exp(logw))/sum(exp(logw))} for \code{x} scalar and
\code{colSums(x*exp(logw))/sum(exp(logw))} for \code{x} matrix
\item \code{lweighted.var()}: weighted variance of \code{x}: \code{crossprod(x-lweighted.mean(x,logw)*exp(logw/2))/sum(exp(logw))}
\item \code{lweighted.cov()}: weighted covariance between \code{x} and \code{y}: \code{crossprod(x-lweighted.mean(x,logw)*exp(logw/2), y-lweighted.mean(y,logw)*exp(logw/2))/sum(exp(logw))}
}}
\examples{
x <- rnorm(1000)
stopifnot(all.equal(log_sum_exp(x), log(sum(exp(x))), check.attributes=FALSE))
stopifnot(all.equal(log_mean_exp(x), log(mean(exp(x))), check.attributes=FALSE))
logw <- rnorm(1000)
stopifnot(all.equal(m <- sum(x*exp(logw))/sum(exp(logw)),lweighted.mean(x, logw)))
stopifnot(all.equal(sum((x-m)^2*exp(logw))/sum(exp(logw)),
lweighted.var(x, logw), check.attributes=FALSE))
x <- cbind(x, rnorm(1000))
stopifnot(all.equal(mx <- colSums(x*exp(logw))/sum(exp(logw)),
lweighted.mean(x, logw), check.attributes=FALSE))
stopifnot(all.equal(crossprod(t(t(x)-mx)*exp(logw/2))/sum(exp(logw)),
lweighted.var(x, logw), check.attributes=FALSE))
y <- cbind(x, rnorm(1000))
my <- colSums(y*exp(logw))/sum(exp(logw))
stopifnot(all.equal(crossprod(t(t(x)-mx)*exp(logw/2), t(t(y)-my)*exp(logw/2))/sum(exp(logw)),
lweighted.cov(x, y, logw), check.attributes=FALSE))
stopifnot(all.equal(crossprod(t(t(y)-my)*exp(logw/2), t(t(x)-mx)*exp(logw/2))/sum(exp(logw)),
lweighted.cov(y, x, logw), check.attributes=FALSE))
}
\author{
Pavel N. Krivitsky
}
\keyword{arith}
statnet.common/man/diff.control.list.Rd 0000644 0001762 0000144 00000002502 14306106355 017630 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/control.utilities.R
\name{diff.control.list}
\alias{diff.control.list}
\alias{print.diff.control.list}
\title{Identify and the differences between two control lists.}
\usage{
\method{diff}{control.list}(x, y = eval(call(class(x)[[1L]])), ignore.environment = TRUE, ...)
\method{print}{diff.control.list}(x, ..., indent = "")
}
\arguments{
\item{x}{a \code{control.list}}
\item{y}{a reference \code{control.list}; defaults to the default
settings for \code{x}.}
\item{ignore.environment}{whether environment for
environment-bearing parameters (such as formulas and functions)
should be considered when comparing.}
\item{...}{Additional arguments to methods.}
\item{indent}{an argument for recursive calls, to facilitate
indentation of nested lists.}
}
\value{
An object of class \code{diff.control.list}: a named list with
an element for each non-identical setting. The element is either
itself a \code{diff.control.list} (if the setting is a control list)
or a named list with elements \code{x} and \code{y}, containing \code{x}'s and
\code{y}'s values of the parameter for that setting.
}
\description{
Identify and the differences between two control lists.
}
\section{Methods (by generic)}{
\itemize{
\item \code{print(diff.control.list)}: A print method.
}}
statnet.common/man/statnet.cite.Rd 0000644 0001762 0000144 00000002413 13416034725 016677 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cite.utilities.R
\name{statnet.cite}
\alias{statnet.cite}
\alias{statnet.cite.head}
\alias{statnet.cite.foot}
\alias{statnet.cite.pkg}
\title{\code{CITATION} file utilities for Statnet packages (DEPRECATED)}
\usage{
statnet.cite.head(pkg)
statnet.cite.foot(pkg)
statnet.cite.pkg(pkg)
}
\arguments{
\item{pkg}{Name of the package whose citation is being generated.}
}
\value{
For \code{statnet.cite.head} and \code{statnet.cite.foot}, an object
of type \code{citationHeader} and \code{citationFooter}, respectively,
understood by the \code{\link{citation}} function, with package name
substituted into the template.
For \code{statnet.cite.pkg}, an object of class \code{\link{bibentry}}
containing a 'software manual' citation for the package constructed from the
current version and author information in the \code{DESCRIPTION} and a
template.
}
\description{
These functions automate citation generation for Statnet Project
packages. They no longer appear to work with CRAN and are thus
deprecated.
}
\examples{
\dontrun{
statnet.cite.head("statnet.common")
statnet.cite.pkg("statnet.common")
statnet.cite.foot("statnet.common")
}
}
\seealso{
citation, citHeader, citFooter, bibentry
}
\keyword{utilities}
statnet.common/man/unused_dots_warning.Rd 0000644 0001762 0000144 00000002312 14364112224 020343 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{unused_dots_warning}
\alias{unused_dots_warning}
\title{An error handler for \code{\link[rlang:check_dots_used]{rlang::check_dots_used()}} that issues a
warning that only lists argument names.}
\usage{
unused_dots_warning(e)
}
\arguments{
\item{e}{a \link{condition} object, typically not passed by
the end-user; see example below.}
}
\description{
This handler parses the error message produced by
\code{\link[rlang:check_dots_used]{rlang::check_dots_used()}}, extracting the names of the unused
arguments, and formats them into a more gentle warning message. It
relies on \CRANpkg{rlang} maintaining its current format.
}
\examples{
\dontshow{
o <- options(warn=1, useFancyQuotes=FALSE)
}
g <- function(b=NULL, ...){
invisible(force(b))
}
f <- function(...){
rlang::check_dots_used(error = unused_dots_warning)
g(...)
}
f() # OK
f(b=2) # OK
f(a=1, b=2, c=3) # Warning about a and c but not about b
\dontshow{
# Test:
stopifnot(grepl("Argument(s) 'a' and 'c' were not recognized or used. Did you mistype an argument name?", tryCatch(f(a=1, b=2, c=3), warning = function(e) e$message), fixed=TRUE))
options(o)
}
}
statnet.common/man/statnetStartupMessage.Rd 0000644 0001762 0000144 00000002725 14057310034 020642 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/startup.utilities.R
\name{statnetStartupMessage}
\alias{statnetStartupMessage}
\title{Construct a "standard" startup message to be printed when the package is
loaded.}
\usage{
statnetStartupMessage(pkgname, friends = c(), nofriends = c())
}
\arguments{
\item{pkgname}{Name of the package whose information is used.}
\item{friends, nofriends}{No longer used.}
}
\value{
A string containing the startup message, to be passed to the
\code{\link[=packageStartupMessage]{packageStartupMessage()}} call or \code{NULL}, if policy
prescribes printing default startup message. (Thus, if
\code{\link[=statnetStartupMessage]{statnetStartupMessage()}} returns \code{NULL}, the calling package should
not call \code{\link[=packageStartupMessage]{packageStartupMessage()}} at all.)
}
\description{
This function uses information returned by \code{\link[=packageDescription]{packageDescription()}}
to construct a standard package startup message according to the
policy of the Statnet Project.
}
\note{
Earlier versions of this function printed a more expansive
message. This may change again as the Statnet Project policy
evolves.
}
\examples{
\dontrun{
.onAttach <- function(lib, pkg){
sm <- statnetStartupMessage("ergm")
if(!is.null(sm)) packageStartupMessage(sm)
}
}
}
\seealso{
\code{\link[=packageDescription]{packageDescription()}}, \code{\link[=packageStartupMessage]{packageStartupMessage()}}
}
\keyword{utilities}
statnet.common/man/unwhich.Rd 0000644 0001762 0000144 00000001252 13416034725 015737 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{unwhich}
\alias{unwhich}
\title{Construct a logical vector with \code{TRUE} in specified positions.}
\usage{
unwhich(which, n)
}
\arguments{
\item{which}{a numeric vector of indices to set to \code{TRUE}.}
\item{n}{total length of the output vector.}
}
\value{
A logical vector of length \code{n} whose elements listed in
\code{which} are set to \code{TRUE}, and whose other elements are set to
\code{FALSE}.
}
\description{
This function is basically an inverse of \code{\link{which}}.
}
\examples{
x <- as.logical(rbinom(10,1,0.5))
stopifnot(all(x == unwhich(which(x), 10)))
}
statnet.common/man/compress_rows.data.frame.Rd 0000644 0001762 0000144 00000003332 13727604572 021211 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{compress_rows.data.frame}
\alias{compress_rows.data.frame}
\alias{decompress_rows.compressed_rows_df}
\title{"Compress" a data frame.}
\usage{
\method{compress_rows}{data.frame}(x, ...)
\method{decompress_rows}{compressed_rows_df}(x, ...)
}
\arguments{
\item{x}{For \code{compress_rows.data.frame} a \code{\link{data.frame}} to be
compressed. For \code{decompress_rows.compress_rows_df} a \code{\link{list}} as
returned by \code{compress_rows.data.frame}.}
\item{...}{Additional arguments, currently unused.}
}
\value{
For \code{compress_rows.data.frame}, a \code{\link{list}} with three
elements: \item{rows }{Unique rows of \code{x}} \item{frequencies }{A vector
of the same length as the number or rows, giving the number of times the
corresponding row is repeated } \item{ordering}{A vector such that if
\code{c} is the compressed data frame, \code{c$rows[c$ordering,,drop=FALSE]}
equals the original data frame, except for row names} \item{rownames}{Row
names of \code{x}}
For \code{decompress_rows.compressed_rows_df}, the original data frame.
}
\description{
\code{compress_rows.data.frame} "compresses" a data frame, returning unique rows
and a tally of the number of times each row is repeated, as well as a
permutation vector that can reconstruct the original data frame.
\code{decompress_rows.compressed_rows_df} reconstructs the original data frame.
}
\examples{
(x <- data.frame(V1=sample.int(3,30,replace=TRUE),
V2=sample.int(2,30,replace=TRUE),
V3=sample.int(4,30,replace=TRUE)))
(c <- compress_rows(x))
stopifnot(all(decompress_rows(c)==x))
}
\seealso{
\code{\link{data.frame}}
}
\keyword{manip}
statnet.common/man/locate_function.Rd 0000644 0001762 0000144 00000004643 14306106355 017453 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/locator.R
\name{locate_function}
\alias{locate_function}
\alias{locate_prefixed_function}
\title{Locate a function with a given name and return it and its environment.}
\usage{
locate_function(name, env = globalenv(), ...)
locate_prefixed_function(
name,
prefix,
errname,
env = globalenv(),
...,
call. = FALSE
)
}
\arguments{
\item{name}{a character string giving the function's name.}
\item{env}{an \code{\link{environment}} where it should search first.}
\item{...}{additional arguments to the warning and error warning messages. See Details.}
\item{prefix}{a character string giving the prefix, so the
searched-for function is \code{prefix.name}.}
\item{errname}{a character string; if given, if the function is not
found an error is raised, with \code{errname} prepended to the error
message.}
\item{call.}{a logical, whether the call
(\code{locate_prefixed_function}) should be a part of the error
message; defaults to \code{FALSE} (which is different from \code{\link[=stop]{stop()}}'s
default).}
}
\value{
If the function is found, an unevaluated call of the form
\code{ENVNAME:::FUNNAME}, which can then be used to call the function
even if it is unexported. If the environment does not have a
name, or is \code{GlobalEnv}, only \code{FUNNAME} is returned. Otherwise,
\code{NULL} is returned.
}
\description{
These functions first search the given environment, then search all
loaded environments, including those where the function is not
exported. If found, they return an unambiguous reference to the
function.
}
\details{
If the initial search fails, a search using
\code{\link[=getAnywhere]{getAnywhere()}} is attempted, with exported ("visible") functions
with the specified name preferred over those that are not. When
multiple equally qualified functions are available, a warning is
printed and an arbitrary one is returned.
Because \code{\link[=getAnywhere]{getAnywhere()}} can be slow, past searches are cached.
}
\section{Functions}{
\itemize{
\item \code{locate_function()}: a low-level function returning the
reference to the function named \code{name}, or \code{NULL} if not found.
\item \code{locate_prefixed_function()}: a helper function that searches for a
function of the form \code{prefix.name} and produces an informative
error message if not found.
}}
\examples{
# Locate a random function in base.
locate_function(".row_names_info")
}
statnet.common/man/fixed.pval.Rd 0000644 0001762 0000144 00000002706 14046234371 016336 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/string.utilities.R
\name{fixed.pval}
\alias{fixed.pval}
\title{Format a p-value in fixed notation.}
\usage{
fixed.pval(
pv,
digits = max(1, getOption("digits") - 2),
eps = 10^-digits,
na.form = "NA",
...
)
}
\arguments{
\item{pv, digits, eps, na.form, ...}{see \code{\link[=format.pval]{format.pval()}}.}
}
\value{
A character vector.
}
\description{
This is a thin wrapper around \code{\link[=format.pval]{format.pval()}} that guarantees fixed
(not scientific) notation, links (by default) the \code{eps} argument to
the \code{digits} argument and vice versa, and sets \code{nsmall} to equal
\code{digits}.
}
\examples{
pvs <- 10^((0:-12)/2)
# Jointly:
fpf <- fixed.pval(pvs, digits = 3)
fpf
format.pval(pvs, digits = 3) # compare
\dontshow{
stopifnot(all(fpf == c("1.000", "0.316", "0.100", "0.032", "0.010", "0.003", "0.001", "<0.001", "<0.001", "<0.001", "<0.001", "<0.001", "<0.001")))
}
# Individually:
fpf <- sapply(pvs, fixed.pval, digits = 3)
fpf
sapply(pvs, format.pval, digits = 3) # compare
\dontshow{
stopifnot(all(fpf == c("1.000", "0.316", "0.100", "0.032", "0.010", "0.003", "0.001", "<0.001", "<0.001", "<0.001", "<0.001", "<0.001", "<0.001")))
}
# Control eps:
fpf <- sapply(pvs, fixed.pval, eps = 1e-3)
fpf
\dontshow{
stopifnot(all(fpf == c("1.000", "0.316", "0.100", "0.032", "0.010", "0.003", "0.001", "<0.001", "<0.001", "<0.001", "<0.001", "<0.001", "<0.001")))
}
}
statnet.common/man/default_options.Rd 0000644 0001762 0000144 00000001770 13754644650 017507 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/startup.utilities.R
\name{default_options}
\alias{default_options}
\title{Set \code{\link[=options]{options()}} according to a named list, skipping those already
set.}
\usage{
default_options(...)
}
\arguments{
\item{...}{see \code{\link[=options]{options()}}: either a list of \code{name=value} pairs or
a single unnamed argument giving a named list of options to set.}
}
\value{
The return value is same as that of \code{\link[=options]{options()}} (omitting
options already set).
}
\description{
This function can be useful for setting default options, which do
not override options set elsewhere.
}
\examples{
options(onesetting=1)
default_options(onesetting=2, anothersetting=3)
stopifnot(getOption("onesetting")==1) # Still 1.
stopifnot(getOption("anothersetting")==3)
default_options(list(yetanothersetting=5, anothersetting=4))
stopifnot(getOption("anothersetting")==3) # Still 3.
stopifnot(getOption("yetanothersetting")==5)
}
statnet.common/man/split.array.Rd 0000644 0001762 0000144 00000002435 13646210041 016536 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{split.array}
\alias{split.array}
\alias{split.matrix}
\title{A \code{\link[=split]{split()}} method for \code{\link{array}} and \code{\link{matrix}} types on a margin.}
\usage{
\method{split}{array}(x, f, drop = FALSE, margin = NULL, ...)
\method{split}{matrix}(x, f, drop = FALSE, margin = NULL, ...)
}
\arguments{
\item{x}{A \code{\link{matrix}} or an \code{\link{array}}.}
\item{f, drop}{See help for \code{\link[=split]{split()}}. Note that \code{drop} here is
\emph{not} for array dimensions: these are always preserved.}
\item{margin}{Which margin of the array to split along. \code{NULL}
splits as \code{\link{split.default}}, dropping dimensions.}
\item{...}{Additional arguments to \code{\link[=split]{split()}}.}
}
\description{
These methods split an \code{\link{array}} and \code{\link{matrix}} into a list of
arrays or matrices with the same number of dimensions
according to the specified margin.
}
\examples{
x <- diag(5)
f <- rep(1:2, c(2,3))
split(x, f, margin=1) # Split rows.
split(x, f, margin=2) # Split columns.
# This is similar to how data frames are split:
stopifnot(identical(split(x, f, margin=1),
lapply(lapply(split(as.data.frame(x), f), as.matrix), unname)))
}
statnet.common/man/xTAx.Rd 0000644 0001762 0000144 00000002702 14427313306 015155 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/matrix.utils.R
\name{xTAx}
\alias{xTAx}
\alias{xAxT}
\alias{xTAx_solve}
\alias{xTAx_qrsolve}
\alias{sandwich_solve}
\title{Common quadratic forms}
\usage{
xTAx(x, A)
xAxT(x, A)
xTAx_solve(x, A, ...)
xTAx_qrsolve(x, A, tol = 1e-07, ...)
sandwich_solve(A, B, ...)
}
\arguments{
\item{x}{a vector}
\item{A}{a square matrix}
\item{...}{additional arguments to subroutines}
\item{tol}{tolerance argument passed to the relevant subroutine}
\item{B}{a square matrix}
}
\description{
Common quadratic forms
}
\details{
These are somewhat inspired by emulator::quad.form.inv()
and others.
}
\section{Functions}{
\itemize{
\item \code{xTAx()}: Evaluate \eqn{x'Ax} for vector \eqn{x} and square
matrix \eqn{A}.
\item \code{xAxT()}: Evaluate \eqn{xAx'} for vector \eqn{x} and square
matrix \eqn{A}.
\item \code{xTAx_solve()}: Evaluate \eqn{x'A^{-1}x} for vector \eqn{x} and
invertible matrix \eqn{A} using \code{\link[=solve]{solve()}}.
\item \code{xTAx_qrsolve()}: Evaluate \eqn{x'A^{-1}x} for vector \eqn{x} and
matrix \eqn{A} using QR decomposition and confirming that \eqn{x}
is in the span of \eqn{A} if \eqn{A} is singular; returns \code{rank}
and \code{nullity} as attributes just in case subsequent calculations
(e.g., hypothesis test degrees of freedom) are affected.
\item \code{sandwich_solve()}: Evaluate \eqn{A^{-1}B(A')^{-1}} for \eqn{B} a
square matrix and \eqn{A} invertible.
}}
statnet.common/man/deprecation-utilities.Rd 0000644 0001762 0000144 00000002764 14057310034 020601 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/deprecation_utils.R
\name{deprecation-utilities}
\alias{deprecation-utilities}
\alias{.Deprecate_once}
\alias{.Deprecate_method}
\title{Utilities to help with deprecating functions.}
\usage{
.Deprecate_once(...)
.Deprecate_method(generic, class)
}
\arguments{
\item{...}{arguments passed to \code{\link[=.Deprecated]{.Deprecated()}}.}
\item{generic, class}{strings giving the generic function name and
class name of the function to be deprecated.}
}
\description{
\code{.Deprecate_once} calls \code{\link[=.Deprecated]{.Deprecated()}}, passing all its arguments
through, but only the first time it's called.
\code{.Deprecate_method} calls
\code{\link[=.Deprecated]{.Deprecated()}}, but only if a method has been called by name,
i.e., \code{\var{METHOD}.\var{CLASS}}. Like \code{.Deprecate_once} it
only issues a warning the first time.
}
\examples{
\dontrun{
options(warn=1) # Print warning immediately after the call.
f <- function(){
.Deprecate_once("new_f")
}
f() # Deprecation warning
f() # No deprecation warning
}
\dontrun{
options(warn=1) # Print warning immediately after the call.
summary.packageDescription <- function(object, ...){
.Deprecate_method("summary", "packageDescription")
invisible(object)
}
summary(packageDescription("statnet.common")) # No warning.
summary.packageDescription(packageDescription("statnet.common")) # Warning.
summary.packageDescription(packageDescription("statnet.common")) # No warning.
}
}
statnet.common/man/mcmc-utilities.Rd 0000644 0001762 0000144 00000004200 13416034725 017216 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mcmc-utils.R
\name{mcmc-utilities}
\alias{mcmc-utilities}
\alias{colMeans.mcmc.list}
\alias{sweep.mcmc.list}
\alias{lapply.mcmc.list}
\title{Utility operations for \code{\link{mcmc.list}} objects}
\usage{
colMeans.mcmc.list(x, ...)
sweep.mcmc.list(x, STATS, FUN = "-", check.margin = TRUE, ...)
lapply.mcmc.list(X, FUN, ...)
}
\arguments{
\item{x}{a \code{\link{mcmc.list}} object.}
\item{\dots}{additional arguments to \code{\link{colMeans}} or
\code{\link{sweep}}.}
\item{STATS, FUN, check.margin}{See help for \code{\link{sweep}}.}
\item{X}{An \code{\link{mcmc.list}} object.}
}
\value{
\code{colMeans.mcmc} returns a vector with length equal to
the number of mcmc chains in \code{x} with the mean value for
each chain.
\code{sweep.mcmc.list} returns an appropriately modified
version of \code{x}
\code{lapply.mcmc.list} returns an \code{\link{mcmc.list}} each of
whose chains had been passed through \code{FUN}.
}
\description{
\code{colMeans.mcmc.list} is a "method" for (non-generic) \code{\link{colMeans}} applicable to \code{\link{mcmc.list}} objects.
\code{sweep.mcmc.list} is a "method" for (non-generic)
\code{\link{sweep}} applicable to \code{\link{mcmc.list}} objects.
\code{lapply.mcmc.list} is a "method" for (non-generic)
\code{\link{lapply}} applicable to \code{\link{mcmc.list}} objects.
}
\examples{
data(line, package="coda")
summary(line) # coda
colMeans.mcmc.list(line) # "Method"
\dontshow{
stopifnot(isTRUE(all.equal(summary(line)$statistics[,"Mean"],colMeans.mcmc.list(line))))
}
data(line, package="coda")
colMeans.mcmc.list(line)-1:3
colMeans.mcmc.list(sweep.mcmc.list(line, 1:3))
\dontshow{
stopifnot(isTRUE(all.equal(colMeans.mcmc.list(sweep.mcmc.list(line, 1:3)), colMeans.mcmc.list(line)-1:3)))
}
data(line, package="coda")
colMeans.mcmc.list(line)[c(2,3,1)]
colMeans.mcmc.list(lapply.mcmc.list(line, `[`,,c(2,3,1)))
\dontshow{
stopifnot(isTRUE(all.equal(colMeans.mcmc.list(line)[c(2,3,1)],colMeans.mcmc.list(lapply.mcmc.list(line, `[`,,c(2,3,1))))))
}
}
\seealso{
\code{\link{colMeans}}, \code{\link{mcmc.list}}
\code{\link{sweep}}
\code{\link{lapply}}
}
statnet.common/man/once.Rd 0000644 0001762 0000144 00000005060 13472461363 015223 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{once}
\alias{once}
\title{Evaluate a function once for a given input.}
\usage{
once(f, expire_after = Inf, max_entries = Inf)
}
\arguments{
\item{f}{A function to modify.}
\item{expire_after}{The number of seconds since it was added to the
database before a particular configuration is "forgotten". This
can be used to periodically remind the user without overwhelming
them.}
\item{max_entries}{The number of distinct configurations to
remember. If not \code{Inf}, \emph{earliest-inserted} configurations will
be removed from the database when capacity is exceeded. (This
exact behavior may change in the future.)}
}
\description{
This is a \code{purrr}-style adverb that checks if a given function has
already been called with a given configuration of arguments and
skips it if it has.
}
\details{
Each modified function instance returned by \code{once()}
maintains a database of previous argument configurations. They
are not in any way compressed, so this database may grow over
time. Thus, this wrapper should be used with caution if arguments
are large objects. This may be replaced with hashing in the
future. In the meantime, you may want to set the \code{max_entries}
argument to be safe.
Different instances of a modified function do not share
databases, even if the function is the same. This means that if
you, say, modify a function within another function, the modified
function will call once per call to the outer function. Modified
functions defined at package level count as the same "instance",
however. See example.
}
\note{
Because the function needs to test whether a particular
configuration of arguments have already been used, do not rely on
lazy evaluation behaviour.
}
\examples{
msg <- once(message)
msg("abc") # Prints.
msg("abc") # Silent.
msg <- once(message) # Starts over.
msg("abc") # Prints.
f <- function(){
innermsg <- once(message)
innermsg("efg") # Prints once per call to f().
innermsg("efg") # Silent.
msg("abcd") # Prints only the first time f() is called.
msg("abcd") # Silent.
}
f() # Prints "efg" and "abcd".
f() # Prints only "efg".
msg3 <- once(message, max_entries=3)
msg3("a") # 1 remembered.
msg3("a") # Silent.
msg3("b") # 2 remembered.
msg3("a") # Silent.
msg3("c") # 3 remembered.
msg3("a") # Silent.
msg3("d") # "a" forgotten.
msg3("a") # Printed.
msg2s <- once(message, expire_after=2)
msg2s("abc") # Prints.
msg2s("abc") # Silent.
Sys.sleep(1)
msg2s("abc") # Silent after 1 sec.
Sys.sleep(1.1)
msg2s("abc") # Prints after 2.1 sec.
}
statnet.common/man/NVL.Rd 0000644 0001762 0000144 00000006324 14306106355 014734 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{NVL}
\alias{NVL}
\alias{NVL2}
\alias{NVL3}
\alias{EVL}
\alias{EVL2}
\alias{EVL3}
\alias{NVL<-}
\alias{EVL<-}
\title{Convenience functions for handling \code{\link{NULL}} objects.}
\usage{
NVL(...)
NVL2(test, notnull, null = NULL)
NVL3(test, notnull, null = NULL)
EVL(...)
EVL2(test, notnull, null = NULL)
EVL3(test, notnull, null = NULL)
NVL(x) <- value
EVL(x) <- value
}
\arguments{
\item{\dots, test}{expressions to be tested.}
\item{notnull}{expression to be returned if \code{test} is not \code{NULL}.}
\item{null}{expression to be returned if \code{test} is \code{NULL}.}
\item{x}{an object to be overwritten if \code{\link{NULL}}.}
\item{value}{new value for \code{x}.}
}
\description{
Convenience functions for handling \code{\link{NULL}} objects.
}
\section{Functions}{
\itemize{
\item \code{NVL()}: Inspired by SQL function \code{NVL}, returns the first argument
that is not \code{NULL}, or \code{NULL} if all arguments are
\code{NULL}.
\item \code{NVL2()}: Inspired by Oracle SQL function \code{NVL2}, returns the second argument
if the first argument is not \code{NULL} and the third argument if the
first argument is \code{NULL}. The third argument defaults to \code{NULL}, so
\code{NVL2(a, b)} can serve as shorthand for \code{(if(!is.null(a)) b)}.
\item \code{NVL3()}: Inspired by Oracle SQL \code{NVL2} function and \code{magittr} \code{\%>\%}
operator, behaves as \code{NVL2} but \code{.}s in the second argument are
substituted with the first argument.
\item \code{EVL()}: As \code{NVL}, but for any objects of length 0 (\emph{E}mpty) rather than just \code{NULL}. Note that if no non-zero-length arguments are given, \code{NULL} is returned.
\item \code{EVL2()}: As \code{NVL2}, but for any objects of length 0 (\emph{E}mpty) rather than just \code{NULL}.
\item \code{EVL3()}: As \code{NVL3}, but for any objects of length 0 (\emph{E}mpty) rather than just \code{NULL}.
\item \code{NVL(x) <- value}: Assigning to \code{NVL} overwrites its first argument if that argument
is \code{\link{NULL}}. Note that it will \emph{always} return the right-hand-side
of the assignment (\code{value}), regardless of what \code{x} is.
\item \code{EVL(x) <- value}: As assignment to \code{NVL}, but for any objects of length 0 (\emph{E}mpty) rather than just \code{NULL}.
}}
\note{
Whenever possible, these functions use lazy evaluation, so,
for example \code{NVL(1, stop("Error!"))} will never evaluate the
\code{\link{stop}} call and will not produce an error, whereas \code{NVL(NULL, stop("Error!"))} would.
}
\examples{
a <- NULL
a # NULL
NVL(a,0) # 0
b <- 1
b # 1
NVL(b,0) # 1
# Here, object x does not exist, but since b is not NULL, x is
# never evaluated, so the statement finishes.
NVL(b,x) # 1
# Also,
NVL(NULL,1,0) # 1
NVL(NULL,0,1) # 0
NVL(NULL,NULL,0) # 0
NVL(NULL,NULL,NULL) # NULL
NVL2(a, "not null!", "null!") # "null!"
NVL2(b, "not null!", "null!") # "not null!"
NVL3(a, "not null!", "null!") # "null!"
NVL3(b, .+1, "null!") # 2
NVL(NULL*2, 1) # numeric(0) is not NULL
EVL(NULL*2, 1) # 1
NVL(a) <- 2
a # 2
NVL(b) <- 2
b # still 1
}
\seealso{
\code{\link{NULL}}, \code{\link[base]{is.null}}, \code{\link[base]{if}}
}
\keyword{utilities}
statnet.common/man/paste.and.Rd 0000644 0001762 0000144 00000001677 13416034725 016162 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/string.utilities.R
\name{paste.and}
\alias{paste.and}
\title{Concatenates the elements of a vector (optionaly enclosing them in quotation
marks or parentheses) adding appropriate punctuation and conjunctions.}
\usage{
paste.and(x, oq = "", cq = "", con = "and")
}
\arguments{
\item{x}{A vector.}
\item{oq}{Opening quotation symbol. (Defaults to none.)}
\item{cq}{Closing quotation symbol. (Defaults to none.)}
\item{con}{Conjunction to be used if \code{length(x)>1}. (Defaults to "and".)}
}
\value{
A string with the output.
}
\description{
A vector \code{x} becomes "\code{x[1]}", "\code{x[1]} and \code{x[2]}", or
"\code{x[1]}, \code{x[2]}, and \code{x[3]}", depending on the langth of
\code{x}.
}
\examples{
print(paste.and(c()))
print(paste.and(1))
print(paste.and(1:2))
print(paste.and(1:3))
print(paste.and(1:4,con='or'))
}
\seealso{
paste, cat
}
\keyword{utilities}
statnet.common/man/term_list.Rd 0000644 0001762 0000144 00000004015 14265207276 016302 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/formula.utilities.R
\name{term_list}
\alias{term_list}
\alias{as.term_list}
\alias{as.term_list.term_list}
\alias{as.term_list.default}
\alias{c.term_list}
\alias{[.term_list}
\alias{print.term_list}
\title{A helper class for list of terms in an formula}
\usage{
term_list(x, sign = +1, env = NULL)
as.term_list(x, ...)
\method{as.term_list}{term_list}(x, ...)
\method{as.term_list}{default}(x, sign = +1, env = NULL, ...)
\method{c}{term_list}(x, ...)
\method{[}{term_list}(x, i, ...)
\method{print}{term_list}(x, ...)
}
\arguments{
\item{x}{a list of terms or a term; a \code{term_list}}
\item{sign}{a vector specifying the signs associated with each term (\code{-1} and \code{+1})}
\item{env}{a list specifying the environments, or NULL}
\item{...}{additional arguments to methods}
\item{i}{list index}
}
\description{
Typically generated by \code{\link[=list_rhs.formula]{list_rhs.formula()}}, it contains, in
addition to a list of \code{\link[=call]{call()}} or similar objects, attributes
\code{"sign"} and \code{"env"}, containing, respectively a vector of
signs that the terms had in the original formula and a list of
environments of the formula from which the term has been
extracted. Indexing and concatenation methods preserve these.
}
\examples{
e1 <- new.env()
f1 <- a~b+c
environment(f1) <- e1
f2 <- ~-NULL+1
(l1 <- list_rhs.formula(f1))
(l2 <- list_rhs.formula(f2))
(l <- c(l1,l2))
\dontshow{
stopifnot(identical(c(unclass(l)), alist(b, c, NULL, 1)))
stopifnot(identical(attr(l, "sign"), c(1,1,-1,1)))
stopifnot(identical(attr(l, "env"), rep(list(e1, globalenv()), each=2)))
}
(l <- c(l2[1], l1[2], l1[1], l1[1], l2[2]))
\dontshow{
stopifnot(identical(c(unclass(l)), alist(NULL, c, b, b, 1)))
stopifnot(identical(attr(l, "sign"), c(-1,1,1,1,1)))
stopifnot(identical(attr(l, "env"), list(globalenv(), e1, e1, e1, globalenv())))
}
}
\seealso{
\code{\link[=list_rhs.formula]{list_rhs.formula()}}, \code{\link[=list_summands.call]{list_summands.call()}}
}
statnet.common/man/ssolve.Rd 0000644 0001762 0000144 00000004150 14427313306 015603 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/matrix.utils.R
\name{ssolve}
\alias{ssolve}
\alias{sginv}
\alias{srcond}
\alias{snearPD}
\alias{xTAx_ssolve}
\alias{xTAx_qrssolve}
\alias{sandwich_ssolve}
\title{Wrappers around matrix algebra functions that pre-\emph{s}cale their
arguments}
\usage{
ssolve(a, b, ..., snnd = TRUE)
sginv(X, ..., snnd = TRUE)
srcond(x, ..., snnd = TRUE)
snearPD(x, ...)
xTAx_ssolve(x, A, ...)
xTAx_qrssolve(x, A, tol = 1e-07, ...)
sandwich_ssolve(A, B, ...)
}
\arguments{
\item{snnd}{assume that the matrix is symmetric non-negative
definite (SNND). If it's "obvious" that it's not (e.g., negative
diagonal elements), an error is raised.}
\item{x, a, b, X, A, B, tol, ...}{corresponding arguments of the wrapped functions.}
}
\description{
Covariance matrices of variables with very different orders of
magnitude can have very large ratios between their greatest and
their least eigenvalues, causing them to appear to the algorithms
to be near-singular when they are actually very much SPD. These
functions first scale the matrix's rows and/or columns by its
diagonal elements and then undo the scaling on the result.
}
\details{
\code{ssolve()}, \code{sginv()}, and \code{snearPD()} wrap \code{\link[=solve]{solve()}},
\code{\link[MASS:ginv]{MASS::ginv()}}, and \code{\link[Matrix:nearPD]{Matrix::nearPD()}}, respectively. \code{srcond()}
returns the reciprocal condition number of \code{\link[=rcond]{rcond()}} net of the
above scaling. \code{xTAx_ssolve}, \code{xTAx_qrssolve}, and
\code{sandwich_ssolve} wrap the corresponding \pkg{statnet.common}
functions.
}
\examples{
x <- rnorm(2, sd=c(1,1e12))
x <- c(x, sum(x))
A <- matrix(c(1, 0, 1,
0, 1e24, 1e24,
1, 1e24, 1e24), 3, 3)
stopifnot(all.equal(
xTAx_qrssolve(x,A),
structure(drop(x\%*\%sginv(A)\%*\%x), rank = 2L, nullity = 1L)
))
x <- rnorm(2, sd=c(1,1e12))
x <- c(x, rnorm(1, sd=1e12))
A <- matrix(c(1, 0, 1,
0, 1e24, 1e24,
1, 1e24, 1e24), 3, 3)
stopifnot(try(xTAx_qrssolve(x,A), silent=TRUE) ==
"Error in xTAx_qrssolve(x, A) : x is not in the span of A\n")
}
statnet.common/man/compress_rows.Rd 0000644 0001762 0000144 00000001416 13727604572 017211 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wmatrix.R
\name{compress_rows}
\alias{compress_rows}
\alias{decompress_rows}
\title{A generic function to compress a row-weighted table}
\usage{
compress_rows(x, ...)
decompress_rows(x, ...)
}
\arguments{
\item{x}{a weighted matrix or data frame.}
\item{...}{extra arguments for methods.}
}
\value{
For \code{compress_rows} A weighted matrix or data frame of the same
type with duplicated rows removed and weights updated appropriately.
}
\description{
Compress a matrix or a data frame with duplicated rows, updating row weights
to reflect frequencies, or reverse the process, reconstructing a matrix like
the one compressed (subject to permutation of rows and weights not adding up
to an integer).
}
statnet.common/man/deInf.Rd 0000644 0001762 0000144 00000001300 13577042065 015315 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{deInf}
\alias{deInf}
\title{Truncate values of high magnitude in a vector.}
\usage{
deInf(x, replace = 1/.Machine$double.eps)
}
\arguments{
\item{x}{a numeric or integer vector.}
\item{replace}{a number or a string \code{"maxint"} or \code{"intmax"}.}
}
\value{
Returns \code{x} with elements whose magnitudes exceed \code{replace}
replaced replaced by \code{replace} (or its negation). If \code{replace} is
\code{"maxint"} or \code{"intmax"}, \code{.Machine$integer.max} is used instead.
\code{NA} and \code{NAN} values are preserved.
}
\description{
Truncate values of high magnitude in a vector.
}
statnet.common/man/opttest.Rd 0000644 0001762 0000144 00000002204 13577042065 015776 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{opttest}
\alias{opttest}
\title{Optionally test code depending on environment variable.}
\usage{
opttest(
expr,
testname = NULL,
testvar = "ENABLE_statnet_TESTS",
yesvals = c("y", "yes", "t", "true", "1"),
lowercase = TRUE
)
}
\arguments{
\item{expr}{An expression to be evaluated only if \code{testvar} is set to a
non-empty value.}
\item{testname}{Optional name of the test. If given, and the test is
skipped, will print a message to that end, including the name of the test,
and instructions on how to enable it.}
\item{testvar}{Environment variable name. If set to one of the
\code{yesvals}, \code{expr} is run. Otherwise, an optional message is
printed.}
\item{yesvals}{A character vector of strings considered affirmative values
for \code{testvar}.}
\item{lowercase}{Whether to convert the value of \code{testvar} to lower
case before comparing it to \code{yesvals}.}
}
\description{
A convenience wrapper to run code based on whether an environment variable
is defined.
}
\keyword{debugging}
\keyword{environment}
\keyword{utilities}
statnet.common/man/check.control.class.Rd 0000644 0001762 0000144 00000004355 13772063421 020141 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/control.utilities.R
\name{check.control.class}
\alias{check.control.class}
\title{Ensure that the class of the control list is one of those that can
be used by the calling function}
\usage{
check.control.class(
OKnames = as.character(ult(sys.calls(), 2)[[1L]]),
myname = as.character(ult(sys.calls(), 2)[[1L]]),
control = get("control", pos = parent.frame())
)
}
\arguments{
\item{OKnames}{List of control function names which are acceptable.}
\item{myname}{Name of the calling function (used in the error
message).}
\item{control}{The control list or a list to be converted to a
control list using \code{control.myname()}. Defaults to the
\code{control} variable in the calling function. See Details for
detailed behavior.}
}
\value{
A valid control list for the function in which it is to be
used. If \code{control} argument is missing, it will also overwrite
the variable \code{control} in the calling environment with it.
}
\description{
This function converts an ordinary \code{list} into a control list (if
needed) and checks that the control list passed is appropriate for
the function to be controlled.
}
\details{
\code{check.control.class()} performs the check by looking up
the class of the \code{control} argument (defaulting to the \code{control}
variable in the calling function) and checking if it matches a
list of acceptable given by \code{OKnames}.
Before performing any checks, the \code{control} argument (including
the default) will be converted to a control list by calling
\code{\link[=as.control.list]{as.control.list()}} on it with the first element of \code{OKnames} to
construct the control function.
If \code{control} is missing, it will be assumed that the user wants
to modify it in place, and a variable with that name in the
parent environment will be overwritten.
}
\note{
In earlier versions, \code{OKnames} and \code{myname} were
autodetected. This capability has been deprecated and results in
a warning issued once per session. They now need to be set
explicitly.
}
\seealso{
\code{\link[=set.control.class]{set.control.class()}}, \code{\link[=print.control.list]{print.control.list()}}, \code{\link[=as.control.list]{as.control.list()}}
}
\keyword{utilities}
statnet.common/man/persistEval.Rd 0000644 0001762 0000144 00000004062 13577042065 016601 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{persistEval}
\alias{persistEval}
\alias{persistEvalQ}
\title{Evaluate an expression, restarting on error}
\usage{
persistEval(
expr,
retries = NVL(getOption("eval.retries"), 5),
beforeRetry,
envir = parent.frame(),
enclos = if (is.list(envir) || is.pairlist(envir)) parent.frame() else baseenv(),
verbose = FALSE
)
persistEvalQ(
expr,
retries = NVL(getOption("eval.retries"), 5),
beforeRetry,
envir = parent.frame(),
enclos = if (is.list(envir) || is.pairlist(envir)) parent.frame() else baseenv(),
verbose = FALSE
)
}
\arguments{
\item{expr}{an expression to be retried; note the difference
between \code{\link[=eval]{eval()}} and \code{\link[=evalq]{evalq()}}.}
\item{retries}{number of retries to make; defaults to
\code{"eval.retries"} option, or 5.}
\item{beforeRetry}{if given, an expression that will be evaluated
before each retry if the initial attempt fails; it is evaluated
in the same environment and with the same quoting semantics as
\code{expr}, but its errors are not handled.}
\item{envir, enclos}{see \code{\link[=eval]{eval()}}.}
\item{verbose}{Whether to output retries.}
}
\value{
Results of evaluating \code{expr}, including side-effects such
as variable assignments, if successful in \code{retries} retries.
}
\description{
A pair of functions paralleling \code{\link[=eval]{eval()}} and \code{\link[=evalq]{evalq()}} that make
multiple attempts at evaluating an expression, retrying on error up
to a specified number of attempts, and optionally evaluating
another expression before restarting.
}
\note{
If \code{expr} returns a \code{"try-error"} object (returned by
\code{\link[=try]{try()}}), it will be treated as an error. This behavior may
change in the future.
}
\examples{
x <- 0
persistEvalQ({if((x<-x+1)<3) stop("x < 3") else x},
beforeRetry = {cat("Will try incrementing...\n")})
x <- 0
e <- quote(if((x<-x+1)<3) stop("x < 3") else x)
persistEval(e,
beforeRetry = quote(cat("Will try incrementing...\n")))
}
statnet.common/man/despace.Rd 0000644 0001762 0000144 00000000576 13577042065 015712 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/string.utilities.R
\name{despace}
\alias{despace}
\title{A one-line function to strip whitespace from its argument.}
\usage{
despace(s)
}
\arguments{
\item{s}{a character vector.}
}
\description{
A one-line function to strip whitespace from its argument.
}
\examples{
stopifnot(despace("\n \t ")=="")
}
statnet.common/man/ERRVL.Rd 0000644 0001762 0000144 00000002716 13416034725 015172 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{ERRVL}
\alias{ERRVL}
\title{Return the first argument passed (out of any number) that is not a
\code{try-error} (result of \code{\link[base]{try}} encountering an error.}
\usage{
ERRVL(...)
}
\arguments{
\item{\dots}{Expressions to be tested; usually outputs of
\code{\link[base]{try}}.}
}
\value{
The first argument that is not a \code{try-error}. Stops
with an error if all are.
}
\description{
This function is inspired by \code{\link{NVL}}, and simply returns the first
argument that is not a \code{try-error}, raising an error if all arguments
are \code{try-error}s.
}
\note{
This function uses lazy evaluation, so, for example \code{ERRVL(1, stop("Error!"))} will never evaluate the \code{\link{stop}} call and will
not produce an error, whereas \code{ERRVL(try(solve(0)), stop("Error!"))} would.
In addition, all expressions after the first may contain a \code{.},
which is substituted with the \code{try-error} object returned by the
previous expression.
}
\examples{
print(ERRVL(1,2,3)) # 1
print(ERRVL(try(solve(0)),2,3)) # 2
print(ERRVL(1, stop("Error!"))) # No error
\dontrun{
# Error:
print(ERRVL(try(solve(0), silent=TRUE),
stop("Error!")))
# Error with an elaborate message:
print(ERRVL(try(solve(0), silent=TRUE),
stop("Stopped with an error: ", .)))
}
}
\seealso{
\code{\link[base]{try}}, \code{\link[base]{inherits}}
}
\keyword{utilities}
statnet.common/man/control.remap.Rd 0000644 0001762 0000144 00000001550 13416034725 017056 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/control.utilities.R
\name{control.remap}
\alias{control.remap}
\title{Overwrite control parameters of one configuration with another.}
\usage{
control.remap(control, from, to)
}
\arguments{
\item{control}{An object of class \code{control.list}.}
\item{from}{Prefix of the source of control parameters.}
\item{to}{Prefix of the destination of control parameters.}
}
\value{
An \code{control.list} object.
}
\description{
Given a \code{control.list}, and two prefixes, \code{from} and \code{to},
overwrite the elements starting with \code{to} with the corresponding
elements starting with \code{from}.
}
\examples{
(l <- set.control.class("test", list(a.x=1, a.y=2)))
control.remap(l, "a", "b")
}
\seealso{
\code{\link{print.control.list}}
}
\author{
Pavel N. Krivitsky
}
\keyword{utilities}
statnet.common/man/message_print.Rd 0000644 0001762 0000144 00000001406 13416034725 017133 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/string.utilities.R
\name{message_print}
\alias{message_print}
\title{\code{\link{print}} objects to the \code{\link{message}} output.}
\usage{
message_print(..., messageArgs = NULL)
}
\arguments{
\item{...}{arguments to \code{\link{print}}.}
\item{messageArgs}{a list of arguments to be passed directly to \code{\link{message}}.}
}
\description{
A thin wrapper around \code{\link{print}} that captures its output and prints
it as a \code{\link{message}}, usually to STDERR.
}
\examples{
cat(1:5)
print(1:5)
message_print(1:5) # Looks the same (though may be in a different color on some frontends).
suppressMessages(print(1:5)) # Still prints
suppressMessages(message_print(1:5)) # Silenced
}
statnet.common/man/simplify_simple.Rd 0000644 0001762 0000144 00000004104 14005764736 017505 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{simplify_simple}
\alias{simplify_simple}
\title{Convert a list to an atomic vector if it consists solely of atomic elements of length 1.}
\usage{
simplify_simple(
x,
toNA = c("null", "empty", "keep"),
empty = c("keep", "unlist"),
...
)
}
\arguments{
\item{x}{an R \code{\link{list}} to be simplified.}
\item{toNA}{a character string indicating whether \code{NULL} entries
(if \code{"null"}) or 0-length entries including \code{NULL} (if \code{"empty"})
should be replaced with \code{NA}s before attempting conversion;
specifying \code{keep} or \code{FALSE} leaves them alone (typically
preventing conversion).}
\item{empty}{a character string indicating how empty lists should
be handled: either \code{"keep"}, in which case they are unchanged or
\code{"unlist"}, in which cases they are unlisted (typically to
\code{NULL}).}
\item{...}{additional arguments passed to \code{\link[=unlist]{unlist()}}.}
}
\value{
an atomic vector or a list of the same length as \code{x}.
}
\description{
This behaviour is not dissimilar to that of \code{\link[=simplify2array]{simplify2array()}}, but
it offers more robust handling of empty or NULL elements and never
promotes to a matrix or an array, making it suitable to be a column
of a \code{\link{data.frame}}.
}
\examples{
(x <- as.list(1:5))
stopifnot(identical(simplify_simple(x), 1:5))
x[3] <- list(NULL) # Put a NULL in place of 3.
x
stopifnot(identical(simplify_simple(x, FALSE), x)) # Can't be simplified without replacing the NULL.
stopifnot(identical(simplify_simple(x), c(1L,2L,NA,4L,5L))) # NULL replaced by NA and simplified.
x[[3]] <- integer(0)
x
stopifnot(identical(simplify_simple(x), x)) # A 0-length vector is not replaced by default,
stopifnot(identical(simplify_simple(x, "empty"), c(1L,2L,NA,4L,5L))) # but can be.
(x <- lapply(1:5, function(i) c(i,i+1L))) # Elements are vectors of equal length.
simplify2array(x) # simplify2array() creates a matrix,
stopifnot(identical(simplify_simple(x), x)) # but simplify_simple() returns a list.
}
statnet.common/man/sort.data.frame.Rd 0000644 0001762 0000144 00000003307 13416034725 017265 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{order}
\alias{order}
\alias{order.default}
\alias{order.data.frame}
\alias{order.matrix}
\alias{sort.data.frame}
\title{Implement the \code{\link{sort}} and \code{\link{order}} methods for
\code{\link{data.frame}} and \code{\link{matrix}}, sorting it in
lexicographic order.}
\usage{
order(..., na.last = TRUE, decreasing = FALSE)
\method{order}{default}(..., na.last = TRUE, decreasing = FALSE)
\method{order}{data.frame}(..., na.last = TRUE, decreasing = FALSE)
\method{order}{matrix}(..., na.last = TRUE, decreasing = FALSE)
\method{sort}{data.frame}(x, decreasing = FALSE, ...)
}
\arguments{
\item{\dots}{Ignored for \code{sort}. For \code{order}, first argument is
the data frame to be ordered. (This is needed for compatibility with
\code{\link[base]{order}}.)}
\item{na.last}{See \code{\link[base]{order}} documentation.}
\item{decreasing}{Whether to sort in decreasing order.}
\item{x}{A \code{\link{data.frame}} to sort.}
}
\value{
For \code{sort}, a data frame, sorted lexicographically. For
\code{order}, a permutation \code{I} (of a vector \code{1:nrow(x)}) such
that \code{x[I,,drop=FALSE]} equals \code{x} ordered lexicographically.
}
\description{
These function return a data frame sorted in lexcographic order or a
permutation that will rearrange it into lexicographic order: first by the
first column, ties broken by the second, remaining ties by the third, etc..
}
\examples{
data(iris)
head(iris)
head(order(iris))
head(sort(iris))
stopifnot(identical(sort(iris),iris[order(iris),]))
}
\seealso{
\code{\link{data.frame}}, \code{\link{sort}}, \code{\link{order}},
\code{\link{matrix}}
}
\keyword{manip}
statnet.common/man/wmatrix_weights.Rd 0000644 0001762 0000144 00000003753 13416034725 017527 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wmatrix.R
\name{wmatrix_weights}
\alias{wmatrix_weights}
\alias{rowweights}
\alias{rowweights.linwmatrix}
\alias{rowweights.logwmatrix}
\alias{lrowweights}
\alias{lrowweights.logwmatrix}
\alias{lrowweights.linwmatrix}
\alias{rowweights<-}
\alias{rowweights<-.linwmatrix}
\alias{rowweights<-.logwmatrix}
\alias{lrowweights<-}
\alias{lrowweights<-.linwmatrix}
\alias{lrowweights<-.logwmatrix}
\alias{rowweights<-.matrix}
\alias{lrowweights<-.matrix}
\title{Set or extract weighted matrix row weights}
\usage{
rowweights(x, ...)
\method{rowweights}{linwmatrix}(x, ...)
\method{rowweights}{logwmatrix}(x, ...)
lrowweights(x, ...)
\method{lrowweights}{logwmatrix}(x, ...)
\method{lrowweights}{linwmatrix}(x, ...)
rowweights(x, ...) <- value
\method{rowweights}{linwmatrix}(x, update = TRUE, ...) <- value
\method{rowweights}{logwmatrix}(x, update = TRUE, ...) <- value
lrowweights(x, ...) <- value
\method{lrowweights}{linwmatrix}(x, update = TRUE, ...) <- value
\method{lrowweights}{logwmatrix}(x, update = TRUE, ...) <- value
\method{rowweights}{matrix}(x, ...) <- value
\method{lrowweights}{matrix}(x, ...) <- value
}
\arguments{
\item{x}{a \code{\link{linwmatrix}}, a \code{\link{logwmatrix}}, or a \code{\link{matrix}}; a
\code{\link{matrix}} is coerced to a weighted matrix of an appropriate
type.}
\item{...}{extra arguments for methods.}
\item{value}{weights to set, on the appropriate scale.}
\item{update}{if \code{TRUE} (the default), the old weights are updated
with the new weights (i.e., corresponding weights are multiplied
on linear scale or added on on log scale); otherwise, they are
overwritten.}
}
\value{
For the accessor functions, the row weights or the row
log-weights; otherwise, a weighted matrix with modified
weights. The type of weight (linear or logarithmic) is converted
to the required type and the type of weighting of the matrix is
preserved.
}
\description{
Set or extract weighted matrix row weights
}
statnet.common/man/all_identical.Rd 0000644 0001762 0000144 00000001045 13416034725 017056 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.utilities.R
\name{all_identical}
\alias{all_identical}
\title{Test if all items in a vector or a list are identical.}
\usage{
all_identical(x)
}
\arguments{
\item{x}{a vector or a list}
}
\value{
\code{TRUE} if all elements of \code{x} are identical to each other.
}
\description{
Test if all items in a vector or a list are identical.
}
\examples{
stopifnot(!all_identical(1:3))
stopifnot(all_identical(list("a", "a", "a")))
}
\seealso{
\code{\link{identical}}
}
statnet.common/man/trim_env.Rd 0000644 0001762 0000144 00000002444 14306106355 016117 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/formula.utilities.R
\name{trim_env}
\alias{trim_env}
\alias{trim_env.environment}
\alias{trim_env.default}
\title{Make a copy of an environment with just the selected objects.}
\usage{
trim_env(object, keep = NULL, ...)
\method{trim_env}{environment}(object, keep = NULL, ...)
\method{trim_env}{default}(object, keep = NULL, ...)
}
\arguments{
\item{object}{An \code{\link{environment}} or an object with
\code{\link[=environment]{environment()}} and \verb{environment()<-} methods.}
\item{keep}{A character vector giving names of variables in the
environment (including its ancestors) to copy over, defaulting to
dropping all. Variables that cannot be resolved are silently
ignored.}
\item{...}{Additional arguments, passed on to lower-level methods.}
}
\value{
An object of the same type as \code{object}, with updated environment.
}
\description{
Make a copy of an environment with just the selected objects.
}
\section{Methods (by class)}{
\itemize{
\item \code{trim_env(environment)}: A method for environment objects.
\item \code{trim_env(default)}: Default method, for objects such as \code{\link{formula}} and \code{\link{function}} that have \code{\link[=environment]{environment()}} and \verb{environment()<-} methods.
}}
statnet.common/man/formula.utilities.Rd 0000644 0001762 0000144 00000017147 14306544510 017760 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/formula.utilities.R
\name{formula.utilities}
\alias{formula.utilities}
\alias{append_rhs.formula}
\alias{append.rhs.formula}
\alias{filter_rhs.formula}
\alias{nonsimp_update.formula}
\alias{nonsimp.update.formula}
\alias{term.list.formula}
\alias{list_summands.call}
\alias{list_rhs.formula}
\alias{eval_lhs.formula}
\title{Functions for Querying, Validating and Extracting from Formulas}
\usage{
append_rhs.formula(
object = NULL,
newterms,
keep.onesided = FALSE,
env = if (is.null(object)) NULL else environment(object)
)
append.rhs.formula(object, newterms, keep.onesided = FALSE)
filter_rhs.formula(object, f, ...)
nonsimp_update.formula(object, new, ..., from.new = FALSE)
nonsimp.update.formula(object, new, ..., from.new = FALSE)
term.list.formula(rhs, sign = +1)
list_summands.call(object)
list_rhs.formula(object)
eval_lhs.formula(object)
}
\arguments{
\item{object}{formula object to be updated or evaluated}
\item{newterms}{a \code{\link{term_list}} object, or any list of terms (names
or calls) to append to the formula, or a formula whose RHS terms
will be used; its \code{"sign"} attribute vector can give the sign of
each term (\code{+1} or \code{-1}), and its \code{"env"} attribute
vector will be used to set its environment, with the first
available being used and subsequent ones producing a warning.}
\item{keep.onesided}{if the initial formula is one-sided, keep it
whether to keep it one-sided or whether to make the initial
formula the new LHS}
\item{env}{an environment for the new formula, if \code{object} is
\code{NULL}}
\item{f}{a function whose first argument is the term and whose
additional arguments are forwarded from \code{...} that returns either
\code{TRUE} or \code{FALSE}, for whether that term should be kept.}
\item{\dots}{Additional arguments. Currently unused.}
\item{new}{new formula to be used in updating}
\item{from.new}{logical or character vector of variable names. controls how
environment of formula gets updated.}
\item{rhs, sign}{Arguments to the deprecated \code{term.list.formula}.}
}
\value{
\code{append_rhs.formula} each return an updated formula
object; if \code{object} is \code{NULL} (the default), a one-sided formula
containing only the terms in \code{newterms} will be returned.
\code{nonsimp_update.formula} each return an
updated formula object
\code{list_summands.call} returns an object of type
\code{\link{term_list}}; its \code{"env"} attribute is set to a list of
\code{NULL}s, however.
\code{list_rhs.formula} returns an object of type \code{\link{term_list}}.
\code{eval_lhs.formula} an object of whatever type the LHS evaluates to.
}
\description{
A suite of utilities for handling model formulas of the style used in Statnet packages.
}
\section{Functions}{
\itemize{
\item \code{append_rhs.formula()}: \code{append_rhs.formula} appends a list of terms to the RHS of a
formula. If the formula is one-sided, the RHS becomes the LHS, if
\code{keep.onesided==FALSE} (the default).
\item \code{append.rhs.formula()}: \code{append.rhs.formula} has been renamed to \code{append_rhs.formula}.
\item \code{filter_rhs.formula()}: \code{filter_rhs.formula} filters through the terms in the RHS of a
formula, returning a formula without the terms for which function
\code{f(term, ...)} is \code{FALSE}. Terms inside another term (e.g.,
parentheses or an operator other than + or -) will be unaffected.
\item \code{nonsimp_update.formula()}: \code{nonsimp_update.formula} is a reimplementation of
\code{\link{update.formula}} that does not simplify. Note that the
resulting formula's environment is set as follows. If
\code{from.new==FALSE}, it is set to that of object. Otherwise, a new
sub-environment of object, containing, in addition, variables in new listed
in from.new (if a character vector) or all of new (if TRUE).
\item \code{nonsimp.update.formula()}: \code{nonsimp.update.formula} has been renamed to \code{nonsimp_update.formula}.
\item \code{term.list.formula()}: \code{term.list.formula} is an older version of \code{list_rhs.formula} that required the RHS call, rather than the formula itself.
\item \code{list_summands.call()}: \code{list_summands.call}, given an unevaluated call or expression
containing the sum of one or more terms, returns an object of class \code{\link{term_list}} with the
terms being summed, handling \code{+} and \code{-} operators and
parentheses, and keeping track of whether a term has a plus or a
minus sign.
\item \code{list_rhs.formula()}: \code{list_rhs.formula} returns an object of type \code{\link{term_list}},
containing terms in a given formula, handling \code{+} and \code{-}
operators and parentheses, and keeping track of whether a term has
a plus or a minus sign.
\item \code{eval_lhs.formula()}: \code{eval_lhs.formula} extracts the LHS of a formula, evaluates it in the formula's environment, and returns the result.
}}
\examples{
## append_rhs.formula
(f1 <- append_rhs.formula(y~x,list(as.name("z1"),as.name("z2"))))
(f2 <- append_rhs.formula(~y,list(as.name("z"))))
(f3 <- append_rhs.formula(~y+x,structure(list(as.name("z")),sign=-1)))
(f4 <- append_rhs.formula(~y,list(as.name("z")),TRUE))
(f5 <- append_rhs.formula(y~x,~z1-z2))
(f6 <- append_rhs.formula(NULL,list(as.name("z"))))
(f7 <- append_rhs.formula(NULL,structure(list(as.name("z")),sign=-1)))
fe <- ~z2+z3
environment(fe) <- new.env()
(f8 <- append_rhs.formula(NULL, fe)) # OK
(f9 <- append_rhs.formula(y~x, fe)) # Warning
(f10 <- append_rhs.formula(y~x, fe, env=NULL)) # No warning, environment from fe.
(f11 <- append_rhs.formula(fe, ~z1)) # Warning, environment from fe
\dontshow{
stopifnot(f1 == (y~x+z1+z2))
stopifnot(f2 == (y~z))
stopifnot(f3 == (y+x~-z))
stopifnot(f4 == (~y+z))
stopifnot(f5 == (y~x+z1-z2))
stopifnot(f6 == (~z))
stopifnot(f7 == (~-z))
stopifnot(f8 == (~z2+z3), identical(environment(f8), environment(fe)))
stopifnot(f9 == (y~x+z2+z3), identical(environment(f9), globalenv()))
stopifnot(f10 == (y~x+z2+z3), identical(environment(f10), environment(fe)))
stopifnot(f11 == (z2+z3~z1), identical(environment(f11), environment(fe)))
}
## filter_rhs.formula
(f1 <- filter_rhs.formula(~a-b+c, `!=`, "a"))
(f2 <- filter_rhs.formula(~-a+b-c, `!=`, "a"))
(f3 <- filter_rhs.formula(~a-b+c, `!=`, "b"))
(f4 <- filter_rhs.formula(~-a+b-c, `!=`, "b"))
(f5 <- filter_rhs.formula(~a-b+c, `!=`, "c"))
(f6 <- filter_rhs.formula(~-a+b-c, `!=`, "c"))
(f7 <- filter_rhs.formula(~c-a+b-c(a),
function(x) (if(is.call(x)) x[[1]] else x)!="c"))
\dontshow{
stopifnot(f1 == ~-b+c)
stopifnot(f2 == ~b-c)
stopifnot(f3 == ~a+c)
stopifnot(f4 == ~-a-c)
stopifnot(f5 == ~a-b)
stopifnot(f6 == ~-a+b)
stopifnot(f7 == ~-a+b)
}
stopifnot(identical(list_rhs.formula(a~b),
structure(alist(b), sign=1, env=list(globalenv()), class="term_list")))
stopifnot(identical(list_rhs.formula(~b),
structure(alist(b), sign=1, env=list(globalenv()), class="term_list")))
stopifnot(identical(list_rhs.formula(~b+NULL),
structure(alist(b, NULL),
sign=c(1,1), env=rep(list(globalenv()), 2), class="term_list")))
stopifnot(identical(list_rhs.formula(~-b+NULL),
structure(alist(b, NULL),
sign=c(-1,1), env=rep(list(globalenv()), 2), class="term_list")))
stopifnot(identical(list_rhs.formula(~+b-NULL),
structure(alist(b, NULL),
sign=c(1,-1), env=rep(list(globalenv()), 2), class="term_list")))
stopifnot(identical(list_rhs.formula(~+b-(NULL+c)),
structure(alist(b, NULL, c),
sign=c(1,-1,-1), env=rep(list(globalenv()), 3), class="term_list")))
## eval_lhs.formula
(result <- eval_lhs.formula((2+2)~1))
stopifnot(identical(result,4))
}
statnet.common/man/as.control.list.Rd 0000644 0001762 0000144 00000003565 14306106355 017335 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/control.utilities.R
\name{as.control.list}
\alias{as.control.list}
\alias{as.control.list.control.list}
\alias{as.control.list.list}
\title{Convert to a control list.}
\usage{
as.control.list(x, ...)
\method{as.control.list}{control.list}(x, ...)
\method{as.control.list}{list}(x, FUN = NULL, unflat = TRUE, ...)
}
\arguments{
\item{x}{An object, usually a \code{\link{list}}, to be converted to a
control list.}
\item{...}{Additional arguments to methods.}
\item{FUN}{Either a \verb{control.*()} function or its name or suffix
(to which \code{"control."} will be prepended); defaults to taking the
nearest (in the call traceback) function that does not begin with
\code{"as.control.list"}, and prepending \code{"control."} to it. (This is
typically the function that called \code{as.control.list()} in the
first place.)}
\item{unflat}{Logical, indicating whether an attempt should be made
to detect whether some of the arguments are appropriate for a
lower-level control function and pass them down.}
}
\value{
a \code{control.list} object.
}
\description{
Convert to a control list.
}
\section{Methods (by class)}{
\itemize{
\item \code{as.control.list(control.list)}: Idempotent method for control lists.
\item \code{as.control.list(list)}: The method for plain lists, which runs
them through \code{FUN}.
}}
\examples{
myfun <- function(..., control=control.myfun()){
as.control.list(control)
}
control.myfun <- function(a=1, b=a+1){
list(a=a,b=b)
}
myfun()
myfun(control = list(a=2))
myfun2 <- function(..., control=control.myfun2()){
as.control.list(control)
}
control.myfun2 <- function(c=3, d=c+2, myfun=control.myfun()){
list(c=c,d=d,myfun=myfun)
}
myfun2()
# Argument to control.myfun() (i.e., a) gets passed to it, and a
# warning is issued for unused argument e.
myfun2(control = list(c=3, a=2, e=3))
}
statnet.common/man/print.control.list.Rd 0000644 0001762 0000144 00000001265 13622373301 020056 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/control.utilities.R
\name{print.control.list}
\alias{print.control.list}
\title{Pretty print the control list}
\usage{
\method{print}{control.list}(x, ..., indent = "")
}
\arguments{
\item{x}{A list generated by a \code{control.*} function.}
\item{\dots}{Additional argument to print methods for individual settings.}
\item{indent}{an argument for recursive calls, to facilitate indentation of nested lists.}
}
\description{
This function prints the control list, including what it can control and the
elements.
}
\seealso{
\code{\link{check.control.class}}, \code{\link{set.control.class}}
}
\keyword{utilities}
statnet.common/man/Welford.Rd 0000644 0001762 0000144 00000003643 14306106355 015700 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Welford.R
\name{Welford}
\alias{Welford}
\alias{update.Welford}
\title{A Welford accumulator for sample mean and variance}
\usage{
Welford(dn, means, vars)
\method{update}{Welford}(object, newdata, ...)
}
\arguments{
\item{dn, means, vars}{initialization of the Welford object: if \code{means}
and \code{vars} are given, they are treated as the running means and
variances, and \code{dn} is their associated sample size, and if not,
\code{dn} is the dimension of the vector (with sample size 0).}
\item{object}{a \code{Welford} object.}
\item{newdata}{either a numeric vector of length \code{d}, a numeric
matrix with \code{d} columns for a group update, or another \code{Welford}
object with the same \code{d}.}
\item{...}{additional arguments to methods.}
}
\value{
an object of type \code{Welford}: a list with four elements:
\enumerate{
\item \code{n}: Running number of observations
\item \code{means}: Running mean for each variable
\item \code{SSDs}: Running sum of squared deviations from the mean for each variable
\item \code{vars}: Running variance of each variable
}
}
\description{
A simple class for keeping track of the running mean and the sum of squared deviations from the mean for a vector.
}
\section{Methods (by generic)}{
\itemize{
\item \code{update(Welford)}: Update a \code{Welford} object with new
data.
}}
\examples{
X <- matrix(rnorm(200), 20, 10)
w0 <- Welford(10)
w <- update(w0, X)
stopifnot(isTRUE(all.equal(w$means, colMeans(X))))
stopifnot(isTRUE(all.equal(w$vars, apply(X,2,var))))
w <- update(w0, X[1:12,])
w <- update(w, X[13:20,])
stopifnot(isTRUE(all.equal(w$means, colMeans(X))))
stopifnot(isTRUE(all.equal(w$vars, apply(X,2,var))))
w <- Welford(12, colMeans(X[1:12,]), apply(X[1:12,], 2, var))
w <- update(w, X[13:20,])
stopifnot(isTRUE(all.equal(w$means, colMeans(X))))
stopifnot(isTRUE(all.equal(w$vars, apply(X,2,var))))
}
statnet.common/man/control.list.accessor.Rd 0000644 0001762 0000144 00000001720 13416034725 020525 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/control.utilities.R
\name{control.list.accessor}
\alias{control.list.accessor}
\alias{$.control.list}
\title{Named element accessor for ergm control lists}
\usage{
\method{$}{control.list}(object, name)
}
\arguments{
\item{object}{list-coearceable object with elements to be searched}
\item{name}{literal character name of list element to search for and return}
}
\value{
Returns the named list element exactly matching \code{name}, or
\code{NULL} if no matching elements found
}
\description{
Utility method that overrides the standard `$' list accessor to disable
partial matching for ergm \code{control.list} objects
}
\details{
Executes \code{\link[base]{getElement}} instead of \code{\link[base]{$}} so
that element names must match exactly to be returned and partially matching
names will not return the wrong object.
}
\seealso{
see \code{\link{getElement}}
}
\author{
Pavel N. Krivitsky
}
statnet.common/DESCRIPTION 0000644 0001762 0000144 00000002404 14433433333 014734 0 ustar ligges users Package: statnet.common
Version: 4.9.0
Date: 2023-05-24
Title: Common R Scripts and Utilities Used by the Statnet Project
Software
Authors@R: c(
person(c("Pavel", "N."), "Krivitsky", role=c("aut","cre"), email="pavel@statnet.org", comment=c(ORCID="0000-0002-9101-3362", affiliation="University of New South Wales")),
person("Skye", "Bender-deMoll", role=c("ctb"), email="skyebend@uw.edu"),
person("Chad", "Klumb", role=c("ctb"), email="cklumb@gmail.com", comment=c(affiliation="University of Washington")))
Description: Non-statistical utilities used by the software developed by the Statnet Project. They may also be of use to others.
Depends: R (>= 3.5)
Imports: utils, methods, coda, parallel, tools
BugReports: https://github.com/statnet/statnet.common/issues
License: GPL-3 + file LICENSE
URL: https://statnet.org
RoxygenNote: 7.2.3
Encoding: UTF-8
Suggests: covr, rlang (>= 1.1.1), MASS, Matrix
NeedsCompilation: yes
Packaged: 2023-05-24 06:07:22 UTC; pavel
Author: Pavel N. Krivitsky [aut, cre] (,
University of New South Wales),
Skye Bender-deMoll [ctb],
Chad Klumb [ctb] (University of Washington)
Maintainer: Pavel N. Krivitsky
Repository: CRAN
Date/Publication: 2023-05-24 16:10:02 UTC
statnet.common/build/ 0000755 0001762 0000144 00000000000 14433324632 014326 5 ustar ligges users statnet.common/build/statnet.common.pdf 0000644 0001762 0000144 00001015512 14433324632 017777 0 ustar ligges users %PDF-1.5
%
2 0 obj
<<
/Type /ObjStm
/N 100
/First 828
/Length 1560
/Filter /FlateDecode
>>
stream
xڵXn:+l)
4(Elg䄲\RyfZ̙92y,`Rq᳄0`c"LĂq|\Lb,,cfEQDb<=H|
1=1~0!WD1 >LJ0)C k I^U/LCE1_܉19^x @"E텸 `q@][!xߥ!~ S B'0hN$2^LƁ-$Yqh2 fK=EH!Cļˏj`#3__
D}
,T#6 r@- B~ l>@ d_q'PC&d6Lz8bR (K)Ē.E~_q%JNvPsdDd)X 9$ފ+|zp]),J A _ >O|` pʎ vq.moZv*uZU].s2K5>~\n=KipoICNAٴFmA;
4
d;՛gWZu4'VeY
l51oءNںȐ}{pm4tƮO8^d:Ou.Vo'˖Y3E$,meIh^%8.^i7ܦ(׆Qg"UzԴt6@awƨ>5bObW7ǎK|m8|êv;U?U]:Jp7q3&ζ[Ϫy;ZZ'<1uWűc7ɦwjp|G(}|V6ȝe>4g("8V}zY̽V{@<Kשn(KָRrrhڵN{=יODr[pp<(Սy֥Nu_998^;6;;%zdZz^$SϫEp^ڭ_QXΉV?iߔƉטaedUz8өa[feFkUX}v
}[[KU8WX/ZYNfpN|xcfr+Hemnz|tgNs^
endstream
endobj
226 0 obj
<<
/Length 1077
/Filter /FlateDecode
>>
stream
xY[o6~ϯ,,yu)k) CJE
ߏ)J./@}7gl:
=Aa-JRأqbz{?잭`
'HTDU[zRl4%@xz? jqx&#s'i#$@1a od!tO H?iB8hiԯL!8Iw6L<
9!kYхICbE"9Bw\!"@Q! hжS+j#5h m(Z[e"gna
+K^w R]k#TՌ?s襛ΌWxFNWZo?Λ:ypZH=pkū"
&;B{ssЏ]B!.]Q]]_"!0RӅ)50HW鋙j8\Vo/IΝk1|+D.s)_snEDQC`wod8 |ZqNLԜ[~DZ:ǦdGЭ(tB
~h4:C! a{\H#QD!BPbSdExxb앵3u\V4-WC;f۪$-}w ikՈc B#J5~@xY89-dkNDV2Y- fQm.]c
i<'z ge*nЏ24>o7'`Y|q$I@7b_x'HB=e϶Tw}dx$#观h<z;plŖ{3cW!cFz8(lw}_\F
endstream
endobj
283 0 obj
<<
/Length 948
/Filter /FlateDecode
>>
stream
x[Mo6W(ĥH֢E(F{-AHɿ/iǍ(Ht.0hIxo4ސ">"͇OGKAEE)!e"&m})sX\d4ÌPwӐ<"(yF]PNfNV56q^x*ʾ|?HBg}xn,zDþ{3Ǚv)(VG[=esRFB[Mv9u7Z*,̚RcY]e'
߰-