Showing 2 of 6 files from the diff.

@@ -121,6 +121,7 @@
Loading
121 121
#' @param labeldata labeldata to use, Default: NULL
122 122
#' @param psub show sub-group p-values, Default: F
123 123
#' @param minMax Whether to use [min,max] instead of [p25,p75] for nonnormal variables. The default is FALSE.
124 +
#' @param showpm Logical, show normal distributed continuous variables as Mean ± SD. Default: F 
124 125
#' @return A matrix object containing what you see is also invisibly returned. This can be assinged a name and exported via write.csv.
125 126
#' @details DETAILS
126 127
#' @examples 
@@ -139,7 +140,7 @@
Loading
139 140
140 141
svyCreateTableOneJS <- function(vars, strata = NULL, strata2 = NULL, data, factorVars = NULL, includeNA = F, test = T,
141 142
                            showAllLevels = T, printToggle = F, quote = F, smd = F, Labels = F, nonnormal = NULL, 
142 -
                            catDigits = 1, contDigits = 2, pDigits = 3, labeldata = NULL, psub = T, minMax = F){
143 +
                            catDigits = 1, contDigits = 2, pDigits = 3, labeldata = NULL, psub = T, minMax = F, showpm = F){
143 144
  
144 145
  . <- level <- variable <- val_label <- V1 <- V2 <- NULL
145 146
  
@@ -174,6 +175,12 @@
Loading
174 175
                  catDigits = catDigits, contDigits = contDigits, minMax = minMax)
175 176
    
176 177
    rownames(ptb1) <- gsub("(mean (SD))", "", rownames(ptb1), fixed=T)
178 +
    
179 +
    if (showpm){
180 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\(", "\u00B1 ", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
181 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\)", "", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
182 +
    }
183 +
    
177 184
    cap.tb1 <- "Total - weighted data"
178 185
    #if (Labels & !is.null(labeldata)){
179 186
    #  ptb1[,1] <- vals.tb1
@@ -185,6 +192,10 @@
Loading
185 192
                            catDigits = catDigits, contDigits = contDigits, pDigits = pDigits, labeldata = labeldata, minMax = minMax)
186 193
    
187 194
    cap.tb1 <- paste("Stratified by ", strata, "- weighted data", sep="")
195 +
    if (showpm){
196 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\(", "\u00B1 ", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
197 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\)", "", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
198 +
    }
188 199
    
189 200
    if (Labels & !is.null(labeldata)){
190 201
      cap.tb1 <- paste("Stratified by ", labeldata[get("variable") == strata, "var_label"][1], "- weighted data", sep="")
@@ -205,6 +216,10 @@
Loading
205 216
    } else{
206 217
      ptb1.cbind <- Reduce(cbind, ptb1.list)
207 218
    }
219 +
    if (showpm){
220 +
      ptb1.cbind[!grepl("(%)", rownames(ptb1.cbind)) & ptb1.cbind[, "p"] != "", ] <- gsub("\\(", "\u00B1 ", ptb1.cbind[!grepl("(%)", rownames(ptb1.cbind)) & ptb1.cbind[, "p"] != "", ] )
221 +
      ptb1.cbind[!grepl("(%)", rownames(ptb1.cbind)) & ptb1.cbind[, "p"] != "", ] <- gsub("\\)", "", ptb1.cbind[!grepl("(%)", rownames(ptb1.cbind)) & ptb1.cbind[, "p"] != "", ] )
222 +
    }
208 223
    
209 224
    #colnum.test = which(colnames(ptb1.cbind) == "test")
210 225
    #ptb1.2group = ptb1.cbind[, c(setdiff(1:ncol(ptb1.cbind), colnum.test), colnum.test[1])]
@@ -273,6 +288,11 @@
Loading
273 288
    ptb1 <- cbind(ptb1, sig)
274 289
    cap.tb1 <- paste("Stratified by ", strata, " and ",strata2, "- weighted data",  sep="")
275 290
    
291 +
    if (showpm){
292 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\(", "\u00B1 ", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
293 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\)", "", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
294 +
    }
295 +
    
276 296
    # Column name
277 297
    if (Labels & !is.null(labeldata)){
278 298
      val_combination <- data.table::CJ(labeldata[variable == strata, val_label], labeldata[variable == strata2, val_label], sorted = F)

@@ -149,12 +149,13 @@
Loading
149 149
#' @param Labels Use Label, Default: F
150 150
#' @param exact A character vector to specify the variables for which the p-values should be those of exact tests. By default all p-values are from large sample approximation tests (chisq.test)., Default: NULL
151 151
#' @param nonnormal A character vector to specify the variables for which the p-values should be those of nonparametric tests. By default all p-values are from normal assumption-based tests (oneway.test)., Default: NULL
152 -
#' @param catDigits Number of digits to print for proportions., Default: 1
152 +
#' @param catDigits Number of digits to print for proportions. Default: 1
153 153
#' @param contDigits Number of digits to print for continuous variables. Default 2.
154 154
#' @param pDigits Number of digits to print for p-values (also used for standardized mean differences), Default: 3
155 155
#' @param labeldata labeldata to use, Default: NULL
156 156
#' @param psub show sub-group p-values, Default: F
157 157
#' @param minMax Whether to use [min,max] instead of [p25,p75] for nonnormal variables. The default is FALSE.
158 +
#' @param showpm Logical, show normal distributed continuous variables as Mean ± SD. Default: F 
158 159
#' @return A matrix object containing what you see is also invisibly returned. This can be assinged a name and exported via write.csv.
159 160
#' @details DETAILS
160 161
#' @examples 
@@ -175,7 +176,7 @@
Loading
175 176
                            testNormal = oneway.test, argsNormal = list(var.equal = F),
176 177
                            testNonNormal = kruskal.test, argsNonNormal = list(NULL), 
177 178
                            showAllLevels = T, printToggle = F, quote = F, smd = F, Labels = F, exact = NULL, nonnormal = NULL, 
178 -
                            catDigits = 1, contDigits = 2, pDigits = 3, labeldata = NULL, psub = T, minMax = F){
179 +
                            catDigits = 1, contDigits = 2, pDigits = 3, labeldata = NULL, psub = T, minMax = F, showpm = F){
179 180
  
180 181
  . <- level <- variable <- val_label <- V1 <- V2 <- NULL
181 182
  #if (Labels & !is.null(labeldata)){
@@ -213,6 +214,10 @@
Loading
213 214
                 showAllLevels = showAllLevels, printToggle = printToggle, quote = quote, smd = smd, varLabels = Labels, nonnormal = nonnormal,
214 215
                 catDigits = catDigits, contDigits = contDigits, pDigits = pDigits, minMax = minMax)
215 216
    rownames(ptb1) <- gsub("(mean (SD))", "", rownames(ptb1), fixed=T)
217 +
    if (showpm){
218 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\(", "\u00B1 ", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
219 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\)", "", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
220 +
    }
216 221
    cap.tb1 <- "Total"
217 222
    #if (Labels & !is.null(labeldata)){
218 223
    #  ptb1[,1] <- vals.tb1
@@ -227,6 +232,11 @@
Loading
227 232
                           showAllLevels = showAllLevels, printToggle = printToggle, quote = quote, Labels = Labels, nonnormal = nonnormal, exact = exact,
228 233
                           catDigits = catDigits, contDigits = contDigits, pDigits = pDigits, labeldata = labeldata, minMax = minMax)
229 234
    
235 +
    if (showpm){
236 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\(", "\u00B1 ", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
237 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\)", "", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
238 +
    }
239 +
    
230 240
    cap.tb1 <- paste("Stratified by ", strata, sep="")
231 241
    
232 242
    if (Labels & !is.null(labeldata)){
@@ -252,6 +262,10 @@
Loading
252 262
    } else{
253 263
      ptb1.cbind <- Reduce(cbind, ptb1.list)
254 264
    }
265 +
    if (showpm){
266 +
      ptb1.cbind[!grepl("(%)", rownames(ptb1.cbind)) & ptb1.cbind[, "p"] != "", ] <- gsub("\\(", "\u00B1 ", ptb1.cbind[!grepl("(%)", rownames(ptb1.cbind)) & ptb1.cbind[, "p"] != "", ] )
267 +
      ptb1.cbind[!grepl("(%)", rownames(ptb1.cbind)) & ptb1.cbind[, "p"] != "", ] <- gsub("\\)", "", ptb1.cbind[!grepl("(%)", rownames(ptb1.cbind)) & ptb1.cbind[, "p"] != "", ] )
268 +
    }
255 269
    
256 270
    #colnum.test = which(colnames(ptb1.cbind) == "test")
257 271
    #ptb1.2group = ptb1.cbind[, c(setdiff(1:ncol(ptb1.cbind), colnum.test), colnum.test[1])]
@@ -335,6 +349,11 @@
Loading
335 349
    ptb1 <- cbind(ptb1, sig)
336 350
    cap.tb1 <- paste("Table 1: Stratified by ", strata, " and ",strata2,  sep="")
337 351
    
352 +
    if (showpm){
353 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\(", "\u00B1 ", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
354 +
      ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] <- gsub("\\)", "", ptb1[!grepl("(%)", rownames(ptb1)) & ptb1[, "p"] != "", ] )
355 +
    }
356 +
    
338 357
    # Column name
339 358
    if (Labels & !is.null(labeldata)){
340 359
      val_combination <- data.table::CJ(labeldata[variable == strata, val_label], labeldata[variable == strata2, val_label], sorted = F)
Files Coverage
R 84.59%
Project Totals (12 files) 84.59%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading