Skip to content

Commit 9dbefcf

Browse files
committed
Added mean and variance to count data tables in fitting module
1 parent 9d38bed commit 9dbefcf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

inst/app/modules/generalFittingModules.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ generalFittingCountsHotTable <- function(input, output, session, stringsAsFactor
119119
dplyr::mutate(
120120
N = 0,
121121
X = 0,
122+
mean = 0,
123+
var = 0,
122124
DI = 0,
123125
u = 0
124126
) %>%
@@ -150,16 +152,17 @@ generalFittingCountsHotTable <- function(input, output, session, stringsAsFactor
150152
N = as.integer(rowSums(.[grep("C", names(.))])),
151153
X = aberr_calc(mytable, power = 1),
152154
X2 = aberr_calc(mytable, power = 2),
153-
var = (X2 - (X^2) / N) / (N - 1),
154155
mean = X / N,
156+
var = (X2 - (X^2) / N) / (N - 1),
155157
DI = var / mean,
156158
u = (var / mean - assessment_u) * sqrt( (N - 1) / (2 * (1 - 1 / X)))
157159
) %>%
158160
dplyr::mutate_at(
159161
c("X", "N", grep("C", names(.), value = TRUE)),
160162
as.integer
161163
) %>%
162-
dplyr::select(-X2, -var, -mean) %>%
164+
# dplyr::select(-X2, -var, -mean) %>%
165+
dplyr::select(-X2) %>%
163166
dplyr::select(D, N, X, everything())
164167
} else {
165168
mytable <- mytable %>%
@@ -188,7 +191,7 @@ generalFittingCountsHotTable <- function(input, output, session, stringsAsFactor
188191

189192
if (num_cols > 3) {
190193
hot <- hot %>%
191-
hot_col(c(2, 3, seq(num_cols - 1, num_cols, 1)), readOnly = TRUE) %>%
194+
hot_col(c(2, 3, seq(num_cols - 3, num_cols, 1)), readOnly = TRUE) %>%
192195
hot_col(num_cols, renderer = "
193196
function (instance, td, row, col, prop, value, cellProperties) {
194197
Handsontable.renderers.NumericRenderer.apply(this, arguments);

0 commit comments

Comments
 (0)