Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit656d1fe

Browse files
committed
data.table threads updated to match input colossus cores
1 parent3ac452e commit656d1fe

38 files changed

+513
-529
lines changed

‎NAMESPACE‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ importFrom(data.table,data.table)
5555
importFrom(data.table,fread)
5656
importFrom(data.table,set)
5757
importFrom(data.table,setDT)
58+
importFrom(data.table,setDTthreads)
5859
importFrom(data.table,setkeyv)
5960
importFrom(data.table,setnames)
6061
importFrom(data.table,setorderv)

‎R/BasicRun.R‎

Lines changed: 133 additions & 17 deletions
Large diffs are not rendered by default.

‎R/CaseControl_Regression.R‎

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,13 @@
1111
#' @return returns a list of the final results
1212
#' @noRd
1313
#' @family Case Control Wrapper Functions
14-
#' @examples
15-
#' library(data.table)
16-
#' ## basic example code reproduced from the starting-description vignette
17-
#' df <- data.table::data.table(
18-
#' "UserID" = c(112, 114, 213, 214, 115, 116, 117),
19-
#' "Starting_Age" = c(18, 20, 18, 19, 21, 20, 18),
20-
#' "Ending_Age" = c(30, 45, 57, 47, 36, 60, 55),
21-
#' "Cancer_Status" = c(0, 0, 1, 0, 1, 0, 0),
22-
#' "a" = c(0, 1, 1, 0, 1, 0, 1),
23-
#' "b" = c(1, 1.1, 2.1, 2, 0.1, 1, 0.2),
24-
#' "c" = c(10, 11, 10, 11, 12, 9, 11),
25-
#' "d" = c(0, 0, 0, 1, 1, 1, 1),
26-
#' "e" = c(0, 0, 1, 0, 0, 0, 1)
27-
#' )
28-
#' # For the interval case
29-
#' time1 <- "Starting_Age"
30-
#' time2 <- "Ending_Age"
31-
#' event <- "Cancer_Status"
32-
#' names <- c("a", "b", "c", "d")
33-
#' a_n <- list(c(1.1, -0.1, 0.2, 0.5), c(1.6, -0.12, 0.3, 0.4))
34-
#' # used to test at a specific point
35-
#' term_n <- c(0, 1, 1, 2)
36-
#' tform <- c("loglin", "lin", "lin", "plin")
37-
#' modelform <- "M"
38-
#' keep_constant <- c(0, 0, 0, 0)
39-
#' control <- list(
40-
#' "ncores" = 2, "lr" = 0.75, "maxiters" = c(5, 5, 5),
41-
#' "halfmax" = 5, "epsilon" = 1e-3, "deriv_epsilon" = 1e-3,
42-
#' "step_max" = 1.0, "thres_step_max" = 100.0,
43-
#' "verbose" = FALSE,
44-
#' "ties" = "breslow", "double_step" = 1
45-
#' )
46-
#' e <- RunCaseControlRegression_Omnibus(df, time1, time2, event,
47-
#' names, term_n, tform, keep_constant,
48-
#' a_n, modelform, control,
49-
#' model_control = list(
50-
#' "stata" = FALSE,
51-
#' "time_risk" = FALSE
52-
#' )
53-
#' )
5414
#' @importFrom rlang .data
5515
RunCaseControlRegression_Omnibus<-function(df,time1="%trunc%",time2="%trunc%",event0="event",names= c("CONST"),term_n= c(0),tform="loglin",keep_constant= c(0),a_n= c(0),modelform="M",control=list(),strat_col="null",cens_weight="null",model_control=list(),cons_mat= as.matrix(c(0)),cons_vec= c(0)) {
5616
func_t_start<- Sys.time()
5717
if (class(df)[[1]]!="data.table") {
5818
tryCatch(
5919
{
60-
df<-setDT(df)# nocov
20+
setDT(df)# nocov
6121
},
6222
error=function(e) {# nocov
6323
df<- data.table(df)# nocov

‎R/Cox_Regression.R‎

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,13 @@
1111
#' @return returns a list of the final results
1212
#' @noRd
1313
#' @family Cox Wrapper Functions
14-
#' @examples
15-
#' library(data.table)
16-
#' ## basic example code reproduced from the starting-description vignette
17-
#' df <- data.table::data.table(
18-
#' "UserID" = c(112, 114, 213, 214, 115, 116, 117),
19-
#' "Starting_Age" = c(18, 20, 18, 19, 21, 20, 18),
20-
#' "Ending_Age" = c(30, 45, 57, 47, 36, 60, 55),
21-
#' "Cancer_Status" = c(0, 0, 1, 0, 1, 0, 0),
22-
#' "a" = c(0, 1, 1, 0, 1, 0, 1),
23-
#' "b" = c(1, 1.1, 2.1, 2, 0.1, 1, 0.2),
24-
#' "c" = c(10, 11, 10, 11, 12, 9, 11),
25-
#' "d" = c(0, 0, 0, 1, 1, 1, 1),
26-
#' "e" = c(0, 0, 1, 0, 0, 0, 1)
27-
#' )
28-
#' # For the interval case
29-
#' time1 <- "Starting_Age"
30-
#' time2 <- "Ending_Age"
31-
#' event <- "Cancer_Status"
32-
#' names <- c("a", "b", "c", "d")
33-
#' a_n <- list(c(1.1, -0.1, 0.2, 0.5), c(1.6, -0.12, 0.3, 0.4))
34-
#' # used to test at a specific point
35-
#' term_n <- c(0, 1, 1, 2)
36-
#' tform <- c("loglin", "lin", "lin", "plin")
37-
#' modelform <- "M"
38-
#' keep_constant <- c(0, 0, 0, 0)
39-
#' control <- list(
40-
#' "ncores" = 2, "lr" = 0.75, "maxiters" = c(5, 5, 5),
41-
#' "halfmax" = 5, "epsilon" = 1e-3, "deriv_epsilon" = 1e-3,
42-
#' "step_max" = 1.0, "thres_step_max" = 100.0,
43-
#' "verbose" = FALSE,
44-
#' "ties" = "breslow", "double_step" = 1, "guesses" = 2
45-
#' )
46-
#' e <- RunCoxRegression_Omnibus(df, time1, time2, event,
47-
#' names, term_n, tform, keep_constant,
48-
#' a_n, modelform, control,
49-
#' model_control = list(
50-
#' "single" = FALSE,
51-
#' "basic" = FALSE, "cr" = FALSE, "null" = FALSE
52-
#' )
53-
#' )
5414
#' @importFrom rlang .data
5515
RunCoxRegression_Omnibus<-function(df,time1="%trunc%",time2="%trunc%",event0="event",names= c("CONST"),term_n= c(0),tform="loglin",keep_constant= c(0),a_n= c(0),modelform="M",control=list(),strat_col="null",cens_weight="null",model_control=list(),cons_mat= as.matrix(c(0)),cons_vec= c(0)) {
5616
func_t_start<- Sys.time()
5717
if (class(df)[[1]]!="data.table") {
5818
tryCatch(
5919
{
60-
df<-setDT(df)# nocov
20+
setDT(df)# nocov
6121
},
6222
error=function(e) {# nocov
6323
df<- data.table(df)# nocov
@@ -290,7 +250,7 @@ Cox_Relative_Risk <- function(df, time1 = "%trunc%", time2 = "%trunc%", event0 =
290250
if (class(df)[[1]]!="data.table") {
291251
tryCatch(
292252
{
293-
df<-setDT(df)# nocov
253+
setDT(df)# nocov
294254
},
295255
error=function(e) {# nocov
296256
df<- data.table(df)# nocov
@@ -338,7 +298,7 @@ RunCoxPlots <- function(df, time1 = "%trunc%", time2 = "%trunc%", event0 = "even
338298
if (class(df)[[1]]!="data.table") {
339299
tryCatch(
340300
{
341-
df<-setDT(df)# nocov
301+
setDT(df)# nocov
342302
},
343303
error=function(e) {# nocov
344304
df<- data.table(df)# nocov
@@ -621,7 +581,7 @@ RunCoxRegression_Omnibus_Multidose <- function(df, time1 = "%trunc%", time2 = "%
621581
if (class(df)[[1]]!="data.table") {
622582
tryCatch(
623583
{
624-
df<-setDT(df)# nocov
584+
setDT(df)# nocov
625585
},
626586
error=function(e) {# nocov
627587
df<- data.table(df)# nocov
@@ -798,7 +758,7 @@ CoxCurveSolver <- function(df, time1 = "%trunc%", time2 = "%trunc%", event0 = "e
798758
if (class(df)[[1]]!="data.table") {
799759
tryCatch(
800760
{
801-
df<-setDT(df)# nocov
761+
setDT(df)# nocov
802762
},
803763
error=function(e) {# nocov
804764
df<- data.table(df)# nocov

‎R/LogitRegression.R‎

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,13 @@
99
#' @return returns a list of the final results
1010
#' @noRd
1111
#' @family Logistic Wrapper Functions
12-
#' @examples
13-
#' library(data.table)
14-
#' ## basic example code reproduced from the starting-description vignette
15-
#' df <- data.table::data.table(
16-
#' "Trials" = c(30, 45, 57, 47, 36, 60, 55),
17-
#' "Cancer_Status" = c(0, 0, 1, 0, 1, 0, 0),
18-
#' "a" = c(0, 1, 1, 0, 1, 0, 1),
19-
#' "b" = c(1, 1.1, 2.1, 2, 0.1, 1, 0.2),
20-
#' "c" = c(10, 11, 10, 11, 12, 9, 11),
21-
#' "d" = c(0, 0, 0, 1, 1, 1, 1),
22-
#' "e" = c(0, 0, 1, 0, 0, 0, 1)
23-
#' )
24-
#' # For the interval case
25-
#' trial <- "Trials"
26-
#' event <- "Cancer_Status"
27-
#' names <- c("a", "b", "c", "d")
28-
#' a_n <- c(1.1, -0.1, 0.2, 0.5) # used to test at a specific point
29-
#' term_n <- c(0, 1, 1, 2)
30-
#' tform <- c("loglin", "lin", "lin", "plin")
31-
#' modelform <- "M"
32-
#' keep_constant <- c(0, 0, 0, 0)
33-
#' control <- list(
34-
#' "ncores" = 2, "lr" = 0.75, "maxiter" = 5,
35-
#' "halfmax" = 5, "epsilon" = 1e-3,
36-
#' "deriv_epsilon" = 1e-3, "step_max" = 1.0,
37-
#' "thres_step_max" = 100.0, "verbose" = FALSE, "ties" = "breslow",
38-
#' "double_step" = 1
39-
#' )
40-
#' strat_col <- "e"
41-
#' e <- RunLogisticRegression_Omnibus(
42-
#' df, trial, event, names, term_n,
43-
#' tform, keep_constant,
44-
#' a_n, modelform,
45-
#' control
46-
#' )
4712
#' @importFrom rlang .data
4813
RunLogisticRegression_Omnibus<-function(df,trial0="CONST",event0="event",names= c("CONST"),term_n= c(0),tform="loglin",keep_constant= c(0),a_n= c(0),modelform="M",control=list(),model_control=list(),cons_mat= as.matrix(c(0)),cons_vec= c(0)) {
4914
func_t_start<- Sys.time()
5015
if (class(df)[[1]]!="data.table") {
5116
tryCatch(
5217
{
53-
df<-setDT(df)# nocov
18+
setDT(df)# nocov
5419
},
5520
error=function(e) {# nocov
5621
df<- data.table(df)# nocov

‎R/Poisson_Regression.R‎

Lines changed: 5 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,13 @@
99
#' @return returns a list of the final results
1010
#' @noRd
1111
#' @family Poisson Wrapper Functions
12-
#' @examples
13-
#' library(data.table)
14-
#' ## basic example code reproduced from the starting-description vignette
15-
#' df <- data.table::data.table(
16-
#' "UserID" = c(112, 114, 213, 214, 115, 116, 117),
17-
#' "Starting_Age" = c(18, 20, 18, 19, 21, 20, 18),
18-
#' "Ending_Age" = c(30, 45, 57, 47, 36, 60, 55),
19-
#' "Cancer_Status" = c(0, 0, 1, 0, 1, 0, 0),
20-
#' "a" = c(0, 1, 1, 0, 1, 0, 1),
21-
#' "b" = c(1, 1.1, 2.1, 2, 0.1, 1, 0.2),
22-
#' "c" = c(10, 11, 10, 11, 12, 9, 11),
23-
#' "d" = c(0, 0, 0, 1, 1, 1, 1),
24-
#' "e" = c(0, 0, 1, 0, 0, 0, 1)
25-
#' )
26-
#' # For the interval case
27-
#' pyr <- "Ending_Age"
28-
#' event <- "Cancer_Status"
29-
#' names <- c("a", "b", "c", "d")
30-
#' a_n <- c(1.1, -0.1, 0.2, 0.5) # used to test at a specific point
31-
#' term_n <- c(0, 1, 1, 2)
32-
#' tform <- c("loglin", "lin", "lin", "plin")
33-
#' modelform <- "M"
34-
#' keep_constant <- c(0, 0, 0, 0)
35-
#' control <- list(
36-
#' "ncores" = 2, "lr" = 0.75, "maxiter" = 5,
37-
#' "halfmax" = 5, "epsilon" = 1e-3,
38-
#' "deriv_epsilon" = 1e-3, "step_max" = 1.0,
39-
#' "thres_step_max" = 100.0, "verbose" = FALSE, "ties" = "breslow",
40-
#' "double_step" = 1
41-
#' )
42-
#' strat_col <- "e"
43-
#' e <- RunPoissonRegression_Omnibus(
44-
#' df, pyr, event, names, term_n,
45-
#' tform, keep_constant,
46-
#' a_n, modelform,
47-
#' control, strat_col
48-
#' )
4912
#' @importFrom rlang .data
5013
RunPoissonRegression_Omnibus<-function(df,pyr0="pyr",event0="event",names= c("CONST"),term_n= c(0),tform="loglin",keep_constant= c(0),a_n= c(0),modelform="M",control=list(),strat_col="null",model_control=list(),cons_mat= as.matrix(c(0)),cons_vec= c(0)) {
5114
func_t_start<- Sys.time()
5215
if (class(df)[[1]]!="data.table") {
5316
tryCatch(
5417
{
55-
df<-setDT(df)# nocov
18+
setDT(df)# nocov
5619
},
5720
error=function(e) {# nocov
5821
df<- data.table(df)# nocov
@@ -181,7 +144,7 @@ RunPoissonEventAssignment <- function(df, pyr0 = "pyr", event0 = "event", names
181144
if (class(df)[[1]]!="data.table") {
182145
tryCatch(
183146
{
184-
df<-setDT(df)# nocov
147+
setDT(df)# nocov
185148
},
186149
error=function(e) {# nocov
187150
df<- data.table(df)# nocov
@@ -266,49 +229,12 @@ RunPoissonEventAssignment <- function(df, pyr0 = "pyr", event0 = "event", names
266229
#' @return returns a list of the final results
267230
#' @noRd
268231
#' @family Poisson Wrapper Functions
269-
#' @examples
270-
#' library(data.table)
271-
#' ## basic example code reproduced from the starting-description vignette
272-
#' df <- data.table::data.table(
273-
#' "UserID" = c(112, 114, 213, 214, 115, 116, 117),
274-
#' "Starting_Age" = c(18, 20, 18, 19, 21, 20, 18),
275-
#' "Ending_Age" = c(30, 45, 57, 47, 36, 60, 55),
276-
#' "Cancer_Status" = c(0, 0, 1, 0, 1, 0, 0),
277-
#' "a" = c(0, 1, 1, 0, 1, 0, 1),
278-
#' "b" = c(1, 1.1, 2.1, 2, 0.1, 1, 0.2),
279-
#' "c" = c(10, 11, 10, 11, 12, 9, 11),
280-
#' "d" = c(0, 0, 0, 1, 1, 1, 1),
281-
#' "e" = c(0, 0, 1, 0, 0, 0, 1)
282-
#' )
283-
#' # For the interval case
284-
#' pyr <- "Ending_Age"
285-
#' event <- "Cancer_Status"
286-
#' names <- c("a", "b", "c", "d")
287-
#' a_n <- c(1.1, -0.1, 0.2, 0.5) # used to test at a specific point
288-
#' term_n <- c(0, 1, 1, 2)
289-
#' tform <- c("loglin", "lin", "lin", "plin")
290-
#' modelform <- "M"
291-
#' keep_constant <- c(0, 0, 0, 0)
292-
#' control <- list(
293-
#' "ncores" = 2, "lr" = 0.75, "maxiter" = 5,
294-
#' "halfmax" = 5, "epsilon" = 1e-3,
295-
#' "deriv_epsilon" = 1e-3, "step_max" = 1.0,
296-
#' "thres_step_max" = 100.0, "verbose" = FALSE, "ties" = "breslow",
297-
#' "double_step" = 1
298-
#' )
299-
#' strat_col <- "e"
300-
#' e <- RunPoissonRegression_Residual(
301-
#' df, pyr, event, names, term_n,
302-
#' tform, keep_constant,
303-
#' a_n, modelform,
304-
#' control, strat_col
305-
#' )
306232
#' @importFrom rlang .data
307233
RunPoissonRegression_Residual<-function(df,pyr0="pyr",event0="event",names= c("CONST"),term_n= c(0),tform="loglin",keep_constant= c(0),a_n= c(0),modelform="M",control=list(),strat_col="null",model_control=list()) {
308234
if (class(df)[[1]]!="data.table") {
309235
tryCatch(
310236
{
311-
df<-setDT(df)# nocov
237+
setDT(df)# nocov
312238
},
313239
error=function(e) {# nocov
314240
df<- data.table(df)# nocov
@@ -399,7 +325,7 @@ PoissonCurveSolver <- function(df, pyr0 = "pyr", event0 = "event", names = c("CO
399325
if (class(df)[[1]]!="data.table") {
400326
tryCatch(
401327
{
402-
df<-setDT(df)# nocov
328+
setDT(df)# nocov
403329
},
404330
error=function(e) {# nocov
405331
df<- data.table(df)# nocov
@@ -511,7 +437,7 @@ RunPoisRegression_Omnibus_Multidose <- function(df, pyr0 = "pyr", event0 = "even
511437
if (class(df)[[1]]!="data.table") {
512438
tryCatch(
513439
{
514-
df<-setDT(df)# nocov
440+
setDT(df)# nocov
515441
},
516442
error=function(e) {# nocov
517443
df<- data.table(df)# nocov

‎R/SurvTypes.R‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ get_form_joint <- function(formula_list, df) {
1212
if (class(df)[[1]]!="data.table") {
1313
tryCatch(
1414
{
15-
df<-setDT(df)# nocov
15+
setDT(df)# nocov
1616
},
1717
error=function(e) {# nocov
1818
df<- data.table(df)# nocov
@@ -263,7 +263,7 @@ get_form_list <- function(surv_obj, model_obj, df) {
263263
if (class(df)[[1]]!="data.table") {
264264
tryCatch(
265265
{
266-
df<-setDT(df)
266+
setDT(df)
267267
},
268268
error=function(e) {
269269
df<- data.table(df)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp