@@ -75,15 +75,15 @@ addParType <- function(pars,suffix,add.idx,overwrite=FALSE){
7575 # # i,j
7676 if (add.idx ){
7777 if (overwrite || ! " i" %in% colnames(pars )){
78- pars [.SD [[col.par.type ]]== " THETA" ,i : = as.integer(sub(" THETA([0-9][0-9]*)" ," \\ 1" ,.SD [[col.parameter ]]))]
78+ pars [pars [[col.par.type ]]== " THETA" ,i : = as.integer(sub(" THETA([0-9][0-9]*)" ," \\ 1" ,.SD [[col.parameter ]]))]
7979
8080
8181 pars [,row : = .I ]
82- pars [.SD [[col.par.type ]]%in% allpars.mat ,
82+ pars [pars [[col.par.type ]]%in% allpars.mat ,
8383 i : = as.integer(sub(
84- pattern = sprintf(" %s\\ (([0-9]+)\\ ,([0-9]+)\\ )" ,.SD [[col.par.type ]]),
84+ pattern = sprintf(" %s\\ (([0-9]+)\\ ,([0-9]+)\\ )" ,.SD [[col.par.type ]][ 1L ] ),
8585 replacement = " \\ 1" ,
86- x = .SD [[col.parameter ]])),
86+ x = .SD [[col.parameter ]][ 1L ] )),
8787 by = row
8888 ]
8989 pars [,row : = NULL ]
@@ -95,11 +95,11 @@ addParType <- function(pars,suffix,add.idx,overwrite=FALSE){
9595 if (any(pars [[col.par.type ]]%in% allpars.mat )){
9696
9797 pars [,row : = .I ]
98- pars [.SD [[col.par.type ]]%in% allpars.mat ,
99- j : = as.integer(sub(pattern = sprintf(" %s\\ (([0-9]+)\\ ,([0-9]+)\\ )" ,.SD [[col.par.type ]]),
98+ pars [pars [[col.par.type ]]%in% allpars.mat ,
99+ j : = as.integer(sub(pattern = sprintf(" %s\\ (([0-9]+)\\ ,([0-9]+)\\ )" ,.SD [[col.par.type ]][ 1L ] ),
100100 replacement = " \\ 2" ,
101- x = .SD [[col.parameter ]]
102- )), by = row ]
101+ x = .SD [[col.parameter ]][ 1L ])),
102+ by = row ]
103103 pars [,row : = NULL ]
104104 }
105105 }
0 commit comments