Skip to content

Commit 7b4faf4

Browse files
committed
removed robCompositions dependency
Also documentation updates
1 parent 366e689 commit 7b4faf4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+128
-492
lines changed

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ License: GPL-2
1010
Encoding: UTF-8
1111
LazyData: true
1212
Imports: compositions,
13-
robCompositions,
14-
testthat,
1513
ggplot2
14+
Suggests: testthat
1615
RoxygenNote: 7.1.1

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#exportPattern("^[[:alpha:]]+")
22
exportPattern("predict_")
33
exportPattern("plot_")
4+
exportPattern("fairclough")
5+
exportPattern("fat_data")
46
importFrom("stats", "predict.lm", "as.formula", "coefficients", "df.residual", "lm", "median", "model.matrix", "qt", "quantile", "residuals")
57
importFrom("utils", "head")
68
importFrom("compositions", "gsi.buildilrBase", "ilr")

R/append_ilr_coords.R

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66
#' @param psi ilrBase passed to \code{compositions::ilr()}
77
#' @export
88
#'
9-
#' @examples
10-
#' library(deltacomp)
11-
#' data(fat_data)
12-
#' head(fat_data)
13-
#' comp_vars <- c("sl", "sb", "lpa", "mvpa")
14-
#' # create sequential binary partition
15-
#' sbp <- create_seq_bin_part(length(comp_vars))
16-
#' # The orthonormal transformation matrix
17-
#' psi <- compositions::gsi.buildilrBase(sbp)
18-
#' head(append_ilr_coords(
19-
#' fat_data,
20-
#' comp_vars,
21-
#' psi
22-
#' ))
23-
#'
24-
#'
25-
#'
9+
# @examples
10+
# library(compositions)
11+
# data(fat_data)
12+
# head(fat_data)
13+
# comp_vars <- c("sl", "sb", "lpa", "mvpa")
14+
# # create sequential binary partition
15+
# sbp <- create_seq_bin_part(length(comp_vars))
16+
# # The orthonormal transformation matrix
17+
# psi <- compositions::gsi.buildilrBase(sbp)
18+
# head(append_ilr_coords(
19+
# fat_data,
20+
# comp_vars,
21+
# psi
22+
# ))
23+
2624

2725

2826
append_ilr_coords <- function(dataf, comps, psi) {

R/check_input_args.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
#' @export
1212
#' @details
1313
#' Throws errors for any problematic input. Returns \code{TRUE} invisibly if no issues found.
14-
#' @examples
15-
#' check_input_args(
16-
#' dataf = fat_data,
17-
#' y = "fat",
18-
#' comps = c("sl", "sb", "lpa", "mvpa"),
19-
#' covars = NULL,
20-
#' deltas = seq(-60, 60, by = 5) / (24 * 60)
21-
#' )
22-
#'
23-
#'
14+
# @examples
15+
# check_input_args(
16+
# dataf = fat_data,
17+
# y = "fat",
18+
# comps = c("sl", "sb", "lpa", "mvpa"),
19+
# covars = NULL,
20+
# deltas = seq(-60, 60, by = 5) / (24 * 60)
21+
# )
22+
#
23+
#
2424

2525

2626

R/check_strictly_positive_vals.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#' Returns \code{TRUE} invisibly otherwise.
1010
#' @export
1111
#'
12-
#' @examples
13-
#' data(fat_data)
14-
#' check_strictly_positive_vals(fat_data, c("lpa", "sl"), tol = 1e-6)
15-
#' # not run (throws error):
16-
#' # check_strictly_positive_vals(data.frame(a = rnorm(10)), "a", tol = 1e-6)
12+
# @examples
13+
# data(fat_data)
14+
# check_strictly_positive_vals(fat_data, c("lpa", "sl"), tol = 1e-6)
15+
# # not run (throws error):
16+
# # check_strictly_positive_vals(data.frame(a = rnorm(10)), "a", tol = 1e-6)
1717
check_strictly_positive_vals <- function(dataf, comps, tol = 1e-6) {
1818

1919
vals <- dataf[, comps]

R/cols_exist.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
#' Returns \code{TRUE} invisibly otherwise.
99
#' @export
1010
#'
11-
#' @examples
12-
#' data(fat_data)
13-
#' cols_exist(fat_data, c("lpa", "sl"))
14-
#' # not run (throws error):
15-
#' # cols_exist(fat_data, "a")
11+
# @examples
12+
# data(fat_data)
13+
# cols_exist(fat_data, c("lpa", "sl"))
14+
# # not run (throws error):
15+
# # cols_exist(fat_data, "a")
1616
cols_exist <- function(dataf, cols) {
1717

1818
if (is_null_or_na(cols)) {

R/create_comparison_matrix.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
#' Note that for both \code{comparisons} options the net change is 0 (each row sums to 0).
1717
#' @export
1818
#'
19-
#' @examples
20-
#' create_comparison_matrix("one-v-one", LETTERS[1:3], c(0.5, 0.3, 0.2))
21-
#' create_comparison_matrix("prop-realloc", LETTERS[1:3], c(0.5, 0.3, 0.2))
19+
# @examples
20+
# create_comparison_matrix("one-v-one", LETTERS[1:3], c(0.5, 0.3, 0.2))
21+
# create_comparison_matrix("prop-realloc", LETTERS[1:3], c(0.5, 0.3, 0.2))
2222
create_comparison_matrix <- function(comparisons, comps, mean_comps) {
2323

2424
K <- poss_comps0 <- NULL

R/create_seq_bin_part.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#' etc
1818
#' @export
1919
#'
20-
#' @examples
21-
#' create_seq_bin_part(3)
22-
#' create_seq_bin_part(4)
23-
#' create_seq_bin_part(10)
20+
# @examples
21+
# create_seq_bin_part(3)
22+
# create_seq_bin_part(4)
23+
# create_seq_bin_part(10)
2424
create_seq_bin_part <- function(n_comp) {
2525

2626

R/extract_lm_quantities.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
#' @param alpha level of significance. Defaults to 0.05.
55
#'
66
#' @return
7-
#' A list containing the \code{lm}'s model matrix (\code{dmX}),
8-
#' the inverse of \code{t(dmX) %*% dmX} (\code{XtX_inv}),
7+
#' A list containing the \code{lm} model matrix (\code{dmX}),
8+
#' the inverse of \code{t(dmX) x dmX} (\code{XtX_inv}),
99
#' the standard error (\code{s_e}),
1010
#' the estimated single column beta matrix (\code{beta_hat}), and
1111
#' the critical value of the relevant degrees of freedom t-dist (\code{crit_val}).
1212
#' @export
1313
#'
14-
#' @examples
15-
#' data(fat_data)
16-
#' lm_fat <- lm(fat ~ sl, data = fat_data)
17-
#' extract_lm_quantities(lm_fat)
14+
# @examples
15+
# data(fat_data)
16+
# lm_fat <- lm(fat ~ sl, data = fat_data)
17+
# extract_lm_quantities(lm_fat)
1818
extract_lm_quantities <- function(lm_X, alpha = 0.05) {
1919

2020
# get the design matrix from the LM

R/fit_lm.R

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11

2-
#' Title
2+
#' fit linear model based on input data.frame
33
#'
4-
#' @param y_str
5-
#' @param X
4+
#' @param y_str a string representation of the column in \code{X} that is the outcome
5+
#' @param X a data.frame or matrix that contains the predictor and outcome variables
66
#'
7-
#' @return
7+
#' @return
8+
#' A \code{lm} object where the \code{y_str} column has been regressed against the remaining
9+
#' columns of \code{X} (with an intercept term as well).
10+
#'
811
#' @export
912
#'
10-
#' @examples
13+
# @examples
14+
# data(fairclough)
15+
# fit_lm("bmi", fairclough[, c("bmi", "sex", "decimal_age")])
1116
fit_lm <- function(y_str, X) {
1217

1318

0 commit comments

Comments
 (0)