Skip to content

Commit ddae0c7

Browse files
committed
Replaces print(..) and cat(...) to message(...)
1 parent 7761ed1 commit ddae0c7

23 files changed

Lines changed: 122 additions & 143 deletions

R/ds.cbind.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ ds.cbind <- function(x=NULL, DataSHIELD.checks=FALSE, force.colnames=NULL, newob
157157
}
158158
colNames <- unlist(colNames)
159159
if(anyDuplicated(colNames) != 0){
160-
cat("\n Warning: Some column names in study", j, "are duplicated and a suffix '.k' will be added to the kth replicate \n")
160+
message("\n Warning: Some column names in study", j, "are duplicated and a suffix '.k' will be added to the kth replicate \n")
161161
}
162162
}
163163
}
@@ -198,30 +198,30 @@ ds.cbind <- function(x=NULL, DataSHIELD.checks=FALSE, force.colnames=NULL, newob
198198
next.class <- DSI::datashield.aggregate(datasources[std], calltext1)
199199
class.vector <- c(class.vector, next.class[[1]])
200200
if (notify.of.progress){
201-
cat("\n",j," of ", length(x), " elements to combine in step 1 of 2 in study ", std, "\n")
201+
message("\n",j," of ", length(x), " elements to combine in step 1 of 2 in study ", std, "\n")
202202
}
203203
}
204204
for(j in 1:length(x)){
205205
test.df <- x[j]
206206
if(class.vector[j]!="data.frame" && class.vector[j]!="matrix"){
207207
colname.vector <- c(colname.vector, test.df)
208208
if (notify.of.progress){
209-
cat("\n",j," of ", length(x), " elements to combine in step 2 of 2 in study ", std, "\n")
209+
message("\n",j," of ", length(x), " elements to combine in step 2 of 2 in study ", std, "\n")
210210
}
211211
}else{
212212
calltext2 <- call('colnamesDS', test.df)
213213
df.names <- DSI::datashield.aggregate(datasources[std], calltext2)
214214
colname.vector <- c(colname.vector, df.names[[1]])
215215
if (notify.of.progress){
216-
cat("\n", j," of ", length(x), " elements to combine in step 2 of 2 in study ", std, "\n")
216+
message("\n", j," of ", length(x), " elements to combine in step 2 of 2 in study ", std, "\n")
217217
}
218218
}
219219
}
220220
colname.list[[std]] <- colname.vector
221221
}
222222

223223
if (notify.of.progress){
224-
cat("\nBoth steps in all studies completed\n")
224+
message("\nBoth steps in all studies completed\n")
225225
}
226226

227227
# prepare name vectors for transmission

R/ds.dataFrame.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ ds.dataFrame <- function(x=NULL, row.names=NULL, check.rows=FALSE, check.names=T
137137
}
138138
colNames <- unlist(colNames)
139139
if(anyDuplicated(colNames) != 0){
140-
cat("\n Warning: Some column names in study", j, "are duplicated and a suffix '.k' will be added to the kth replicate \n")
140+
message("\n Warning: Some column names in study", j, "are duplicated and a suffix '.k' will be added to the kth replicate \n")
141141
}
142142
}
143143
}
@@ -178,30 +178,30 @@ ds.dataFrame <- function(x=NULL, row.names=NULL, check.rows=FALSE, check.names=T
178178
next.class <- DSI::datashield.aggregate(datasources[std], calltext1)
179179
class.vector <- c(class.vector, next.class[[1]])
180180
if (notify.of.progress){
181-
cat("\n",j," of ", length(x), " elements to combine in step 1 of 2 in study ", std, "\n")
181+
message("\n",j," of ", length(x), " elements to combine in step 1 of 2 in study ", std, "\n")
182182
}
183183
}
184184
for(j in 1:length(x)){
185185
test.df <- x[j]
186186
if(class.vector[j]!="data.frame" && class.vector[j]!="matrix"){
187187
colname.vector <- c(colname.vector, test.df)
188188
if (notify.of.progress){
189-
cat("\n",j," of ", length(x), " elements to combine in step 2 of 2 in study ", std, "\n")
189+
message("\n",j," of ", length(x), " elements to combine in step 2 of 2 in study ", std, "\n")
190190
}
191191
}else{
192192
calltext2 <- call('colnamesDS', test.df)
193193
df.names <- DSI::datashield.aggregate(datasources[std], calltext2)
194194
colname.vector <- c(colname.vector, df.names[[1]])
195195
if (notify.of.progress){
196-
cat("\n", j," of ", length(x), " elements to combine in step 2 of 2 in study ", std, "\n")
196+
message("\n", j," of ", length(x), " elements to combine in step 2 of 2 in study ", std, "\n")
197197
}
198198
}
199199
}
200200
colname.list[[std]] <- colname.vector
201201
}
202202

203203
if (notify.of.progress){
204-
cat("\nBoth steps in all studies completed\n")
204+
message("\nBoth steps in all studies completed\n")
205205
}
206206

207207
# prepare vectors for transmission

R/ds.dataFrameSubset.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ if(!is.null(rm.cols)){
231231
if (notify.of.progress)
232232
{
233233
if(num.messages==1){
234-
cat("\nSource",s,"\n",return.warning.message[[s]][[1]],"\n")
234+
message("\nSource",s,"\n",return.warning.message[[s]][[1]],"\n")
235235
}else{
236-
cat("\nSource",s,"\n")
236+
message("\nSource",s,"\n")
237237
for(m in 1:(num.messages-1)){
238-
cat(return.warning.message[[s]][[m]],"\n")
238+
message(return.warning.message[[s]][[m]],"\n")
239239
}
240-
cat(return.warning.message[[s]][[num.messages]],"\n")
240+
message(return.warning.message[[s]][[num.messages]],"\n")
241241
}
242242
}
243243
}

R/ds.dmtC2S.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ if(dplyr::is.tbl(dfdata))
9393

9494
if(!is.matrix(dfdata) && !is.data.frame(dfdata) && !dplyr::is.tbl(dfdata))
9595
{
96-
cat("\n FAILED: <dfdata> must either be a data.frame, matrix or tibble")
96+
message("\n FAILED: <dfdata> must either be a data.frame, matrix or tibble")
9797
return('Please respecify')
9898
}
9999

R/ds.extractQuantiles.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ datasources.in.current.function<-datasources
224224
#CALL CLIENTSIDE FUNCTION ds.dmtC2S TO RETURN final.quantile.df TO SERVERSIDE
225225
dsBaseClient::ds.dmtC2S(dfdata=final.quantile.df,newobj="final.quantile.df",datasources = datasources.in.current.function)
226226

227-
cat("\n\n\n"," FINAL RANKING PROCEDURES COMPLETE:
227+
message("\n\n\n"," FINAL RANKING PROCEDURES COMPLETE:
228228
PRIMARY RANKING OUTPUT IS IN DATA FRAME",extract.summary.output.ranks.df,
229229
"
230230
WHICH IS SORTED BY",extract.ranks.sort.by," AND HAS BEEN

R/ds.forestplot.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#' See details from \code{?meta::metagen} for the different options.
1111
#' @param layout \code{character} (default \code{"JAMA"}) Layout of the plot.
1212
#' See details from \code{?meta::metagen} for the different options.
13+
#' @return Results a foresplot object created with `meta::forest`.
1314
#'
1415
#' @export
1516
#'

R/ds.glm.R

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,10 @@ ds.glm <- function(formula=NULL, data=NULL, family=NULL, offset=NULL, weights=NU
343343
# to provide name of offset or weights variable
344344
if(sum(as.numeric(grepl('offset', formula, ignore.case=TRUE)))>0 ||
345345
sum(as.numeric(grepl('weights', formula, ignore.case=TRUE)))>0){
346-
cat("\n\n WARNING: you may have specified an offset or regression weights")
347-
cat("\n as part of the model formula. In ds.glm (unlike the usual glm in R)")
348-
cat("\n you must specify an offset or weights separately from the formula")
349-
cat("\n using the offset or weights argument.\n\n")
346+
message("\n\n WARNING: you may have specified an offset or regression weights")
347+
message("\n as part of the model formula. In ds.glm (unlike the usual glm in R)")
348+
message("\n you must specify an offset or weights separately from the formula")
349+
message("\n using the offset or weights argument.\n\n")
350350
}
351351

352352
formula <- stats::as.formula(formula)
@@ -451,12 +451,12 @@ ds.glm <- function(formula=NULL, data=NULL, family=NULL, offset=NULL, weights=NU
451451
"Any values of 1 in the following tables denote potential disclosure risks\n",
452452
"please use the argument <datasources> to include only valid studies.\n",
453453
"Errors by study are as follows:\n")
454-
print(as.matrix(y.invalid))
455-
print(as.matrix(Xpar.invalid))
456-
print(as.matrix(w.invalid))
457-
print(as.matrix(o.invalid))
458-
print(as.matrix(glm.saturation.invalid))
459-
print(as.matrix(errorMessage))
454+
message(as.matrix(y.invalid))
455+
message(as.matrix(Xpar.invalid))
456+
message(as.matrix(w.invalid))
457+
message(as.matrix(o.invalid))
458+
message(as.matrix(glm.saturation.invalid))
459+
message(as.matrix(errorMessage))
460460

461461
return(list(
462462
output.blocked.information.1,

R/ds.glmSLMA.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,10 @@ ds.glmSLMA<-function(formula=NULL, family=NULL, offset=NULL, weights=NULL, combi
398398
if(sum(as.numeric(grepl('offset', formula, ignore.case=TRUE)))>0 ||
399399
sum(as.numeric(grepl('weights', formula, ignore.case=TRUE)))>0)
400400
{
401-
cat("\n\n WARNING: you may have specified an offset or regression weights")
402-
cat("\n as part of the model formula. In ds.glm (unlike the usual glm in R)")
403-
cat("\n you must specify an offset or weights separately from the formula")
404-
cat("\n using the offset or weights argument.\n\n")
401+
message("\n\n WARNING: you may have specified an offset or regression weights")
402+
message("\n as part of the model formula. In ds.glm (unlike the usual glm in R)")
403+
message("\n you must specify an offset or weights separately from the formula")
404+
message("\n using the offset or weights argument.\n\n")
405405
}
406406

407407
formula <- stats::as.formula(formula)
@@ -617,7 +617,7 @@ if(at.least.one.study.data.error)
617617
}
618618

619619
if (notify.of.progress) {
620-
cat("\n\nSAVING SERVERSIDE glm OBJECT AS: <",newobj,">\n\n")
620+
message("\n\nSAVING SERVERSIDE glm OBJECT AS: <",newobj,">\n\n")
621621
}
622622

623623
calltext.2 <- call('glmSLMADS.assign', formula, family, offset, weights, dataName)
@@ -664,17 +664,17 @@ if(!all.studies.valid)
664664
{
665665
for(sse in study.with.errors)
666666
{
667-
cat("\n","Error report from second serverside function for study",sse,"\n")
668-
cat("############################################################","\n")
669-
cat(unlist(study.summary[[sse]][[1]]),"\n")
670-
cat(unlist(study.summary[[sse]][[2]]),"\n\n")
667+
message("\n","Error report from second serverside function for study",sse,"\n")
668+
message("############################################################","\n")
669+
message(unlist(study.summary[[sse]][[1]]),"\n")
670+
message(unlist(study.summary[[sse]][[2]]),"\n\n")
671671

672672
num.messages<-length(study.summary[[sse]])-2
673673
for(m in 1:num.messages)
674674
{
675675
if(!is.null(unlist(study.summary[[sse]][[2+m]])))
676676
{
677-
cat(unlist(study.summary[[sse]][[2+m]]),"\n\n")
677+
message(unlist(study.summary[[sse]][[2+m]]),"\n\n")
678678
}
679679
}
680680
}
@@ -806,8 +806,8 @@ if(num.valid.studies>1){
806806

807807

808808
if(!coefficient.vectors.match){
809-
cat("\n\nModels in different sources vary in structure\nplease match coefficients for meta-analysis individually\n")
810-
cat("nYou can use the DataSHIELD generated estimates and standard errors as the basis for a meta-analysis\nbut carry out the final pooling step independently of DataSHIELD using whatever meta-analysis package you wish\n\n")
809+
message("\n\nModels in different sources vary in structure\nplease match coefficients for meta-analysis individually\n")
810+
message("nYou can use the DataSHIELD generated estimates and standard errors as the basis for a meta-analysis\nbut carry out the final pooling step independently of DataSHIELD using whatever meta-analysis package you wish\n\n")
811811
return(list(output.summary=output.summary))
812812
}
813813

R/ds.glmSummary.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,17 @@ if(obj.name.exists.in.all.sources && obj.non.null.in.all.sources){ #
172172
#
173173
#
174174
# if(no.errors){ #
175-
# cat("\n\nCREATE ASSIGN OBJECT\n") #
175+
# message("\n\nCREATE ASSIGN OBJECT\n") #
176176
# #
177177
# validity.check<-paste0("<",test.obj.name, "> appears valid in all sources") #
178178
# print(list(is.object.created=return.message,validity.check=validity.check)) #
179179
# } #
180180
#
181181
if(!no.errors){ #
182-
validity.check<-paste0("<",test.obj.name,"> invalid in at least one source. See studyside.messages:") #
183-
print(list(is.object.created=return.message,validity.check=validity.check, #
184-
studyside.messages=studyside.message)) #
185-
} #
182+
validity.check<-paste0("<",test.obj.name,"> invalid in at least one source. See studyside.messages:") #
183+
message(list(is.object.created=return.message,validity.check=validity.check, #
184+
studyside.messages=studyside.message)) #
185+
} #
186186
#
187187
#END OF CHECK OBJECT CREATED CORECTLY MODULE #
188188
#############################################################################################################

R/ds.glmerSLMA.R

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ ds.glmerSLMA <- function(formula=NULL, offset=NULL, weights=NULL, combine.with.m
269269
if(sum(as.numeric(grepl('offset', formula, ignore.case=TRUE)))>0 ||
270270
sum(as.numeric(grepl('weights', formula, ignore.case=TRUE)))>0)
271271
{
272-
cat("\n\n WARNING: you may have specified an offset or regression weights")
273-
cat("\n as part of the model formula. In ds.glm (unlike the usual glm in R)")
274-
cat("\n you must specify an offset or weights separately from the formula")
275-
cat("\n using the offset or weights argument.\n\n")
272+
message("\n\n WARNING: you may have specified an offset or regression weights")
273+
message("\n as part of the model formula. In ds.glm (unlike the usual glm in R)")
274+
message("\n you must specify an offset or weights separately from the formula")
275+
message("\n using the offset or weights argument.\n\n")
276276
}
277277

278278
formula <- stats::as.formula(formula)
@@ -363,7 +363,7 @@ ds.glmerSLMA <- function(formula=NULL, offset=NULL, weights=NULL, combine.with.m
363363

364364

365365
if (notify.of.progress) {
366-
cat("\n\nSAVING SERVERSIDE glmerMod OBJECT AS: <",newobj,">\n\n")
366+
message("\n\nSAVING SERVERSIDE glmerMod OBJECT AS: <",newobj,">\n\n")
367367
}
368368

369369
calltext.2 <- call('glmerSLMADS.assign', formula, offset, weights, dataName, family,
@@ -407,26 +407,26 @@ ds.glmerSLMA <- function(formula=NULL, offset=NULL, weights=NULL, combine.with.m
407407
{
408408
for(sse in study.with.errors)
409409
{
410-
cat("\n","Error report from second serverside function for study",sse,"\n")
411-
cat("############################################################","\n")
412-
cat(unlist(study.summary[[sse]][[1]]),"\n")
413-
cat(unlist(study.summary[[sse]][[2]]),"\n\n")
410+
message("\n","Error report from second serverside function for study",sse,"\n")
411+
message("############################################################","\n")
412+
message(unlist(study.summary[[sse]][[1]]),"\n")
413+
message(unlist(study.summary[[sse]][[2]]),"\n\n")
414414

415415
num.messages<-length(study.summary[[sse]])-2
416416
for(m in 1:num.messages)
417417
{
418418
if(!is.null(unlist(study.summary[[sse]][[2+m]])))
419419
{
420-
cat(unlist(study.summary[[sse]][[2+m]]),"\n\n")
420+
message(unlist(study.summary[[sse]][[2+m]]),"\n\n")
421421
}
422422
}
423423
}
424424
}
425425

426426
if(all.studies.valid)
427427
{
428-
cat("\nAll studies passed disclosure tests\n")
429-
cat("Please check for convergence warnings in the study summaries\n\n\n")
428+
message("\nAll studies passed disclosure tests\n")
429+
message("Please check for convergence warnings in the study summaries\n\n\n")
430430
}
431431
}
432432

@@ -551,8 +551,8 @@ ds.glmerSLMA <- function(formula=NULL, offset=NULL, weights=NULL, combine.with.m
551551

552552

553553
if(!coefficient.vectors.match){
554-
cat("\n\nModels in different sources vary in structure\nplease match coefficients for meta-analysis individually\n")
555-
cat("nYou can use the DataSHIELD generated estimates and standard errors as the basis for a meta-analysis\nbut carry out the final pooling step independently of DataSHIELD using whatever meta-analysis package you wish\n\n")
554+
message("\n\nModels in different sources vary in structure\nplease match coefficients for meta-analysis individually\n")
555+
message("nYou can use the DataSHIELD generated estimates and standard errors as the basis for a meta-analysis\nbut carry out the final pooling step independently of DataSHIELD using whatever meta-analysis package you wish\n\n")
556556
return(list(output.summary=output.summary))
557557
}
558558

@@ -615,10 +615,10 @@ ds.glmerSLMA <- function(formula=NULL, offset=NULL, weights=NULL, combine.with.m
615615

616616
if (notify.of.progress)
617617
{
618-
cat("Convergence information\n")
618+
message("Convergence information\n")
619619
for(r in 1:numstudies)
620620
{
621-
cat(full.error.message[r],"\n")
621+
message(full.error.message[r],"\n")
622622
}
623623
}
624624

0 commit comments

Comments
 (0)