rsetienne / DDD

Diversity-Dependent Diversification
3 stars 4 forks source link

Merge changes in master with develop #26

Closed rsetienne closed 3 years ago

lintr-bot commented 3 years ago

R/bd_loglik_choosepar.R:1:1: style: Lines should not be more than 80 characters.

​bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik_choosepar.R:1:21: style: Use <-, not =, for assignment.

​bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                    ^

R/bd_loglik_choosepar.R:1:42: style: Commas should always have a space after.

​bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                         ^

R/bd_loglik_choosepar.R:1:52: style: Commas should always have a space after.

​bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                   ^

R/bd_loglik_choosepar.R:1:62: style: Commas should always have a space after.

​bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                             ^

R/bd_loglik_choosepar.R:1:72: style: Commas should always have a space after.

​bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                                       ^

R/bd_loglik_choosepar.R:1:78: style: Commas should always have a space after.

​bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                                             ^

R/bd_loglik_choosepar.R:1:83: style: Commas should always have a space after.

​bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                                                  ^

R/bd_loglik_choosepar.R:1:95: style: Commas should always have a space after.

​bd_loglik_choosepar = function(trparsopt,trparsfix,idparsopt,idparsfix,pars2,brts,missnumspec,methode)
                                                                                              ^

R/bd_loglik_choosepar.R:2:1: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​{
^

R/bd_loglik_choosepar.R:3:12: style: Use <-, not =, for assignment.

​   trpars1 = rep(0,4)
           ^

R/bd_loglik_choosepar.R:3:20: style: Commas should always have a space after.

​   trpars1 = rep(0,4)
                   ^

R/bd_loglik_choosepar.R:4:23: style: Use <-, not =, for assignment.

​   trpars1[idparsopt] = trparsopt
                      ^

R/bd_loglik_choosepar.R:5:6: style: Place a space before left parenthesis, except in a function call.

​   if(length(idparsfix) != 0)
     ^

R/bd_loglik_choosepar.R:6:4: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​   {
   ^

R/bd_loglik_choosepar.R:7:26: style: Use <-, not =, for assignment.

​      trpars1[idparsfix] = trparsfix
                         ^

R/bd_loglik_choosepar.R:9:6: style: Place a space before left parenthesis, except in a function call.

​   if(max(trpars1) > 1 | min(trpars1) < 0)
     ^

R/bd_loglik_choosepar.R:10:4: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​   {
   ^

R/bd_loglik_choosepar.R:11:14: style: Use <-, not =, for assignment.

​      loglik = -Inf
             ^

R/bd_loglik_choosepar.R:13:13: style: Use <-, not =, for assignment.

​      pars1 = trpars1/(1 - trpars1)
            ^

R/bd_loglik_choosepar.R:13:22: style: Put spaces around all infix operators.

​      pars1 = trpars1/(1 - trpars1)
                    ~^~

R/bd_loglik_choosepar.R:13:23: style: Place a space before left parenthesis, except in a function call.

​      pars1 = trpars1/(1 - trpars1)
                      ^

R/bd_loglik_choosepar.R:14:1: style: Lines should not be more than 80 characters.

​      loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik_choosepar.R:14:14: style: Use <-, not =, for assignment.

​      loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
             ^

R/bd_loglik_choosepar.R:14:40: style: Commas should always have a space after.

​      loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
                                       ^

R/bd_loglik_choosepar.R:14:59: style: Commas should always have a space after.

​      loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
                                                          ^

R/bd_loglik_choosepar.R:14:71: style: Commas should always have a space after.

​      loglik = bd_loglik(pars1 = pars1,pars2 = pars2[1:6],brts = brts,missnumspec = missnumspec, methode = methode)
                                                                      ^

R/bd_loglik_choosepar.R:15:9: style: Place a space before left parenthesis, except in a function call.

​      if(is.nan(loglik) || is.na(loglik))
        ^

R/bd_loglik_choosepar.R:16:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/bd_loglik_choosepar.R:17:1: style: Lines should not be more than 80 characters.

​         cat("There are parameter values used which cause numerical problems.\n")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik_choosepar.R:18:17: style: Use <-, not =, for assignment.

​         loglik = -Inf
                ^

R/bd_loglik.R:41:80: style: Trailing whitespace is superfluous.

​#' \cr \cr \code{pars2[4]} sets whether the parameters and likelihood should be 
                                                                               ^

R/bd_loglik.R:59:68: style: Trailing whitespace is superfluous.

​#' bd_loglik(pars1 = c(0.5,0.1), pars2 = c(0,1,1,0,2), brts = 1:10, 
                                                                   ^

R/bd_loglik.R:62:1: style: functions should have cyclomatic complexity of less than 15, this has 71.

​bd_loglik <- function(pars1, pars2, brts, missnumspec, methode = "lsoda"){
^

R/bd_loglik.R:62:73: style: There should be a space between right parenthesis and an opening curly brace.

​bd_loglik <- function(pars1, pars2, brts, missnumspec, methode = "lsoda"){
                                                                        ^

R/bd_loglik.R:66:1: style: Lines should not be more than 80 characters.

​  # - pars1[3] = la1 = parameter in exponential decay of speciation rate, OR K in 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:66:82: style: Trailing whitespace is superfluous.

​  # - pars1[3] = la1 = parameter in exponential decay of speciation rate, OR K in 
                                                                                 ^

R/bd_loglik.R:70:62: style: Trailing whitespace is superfluous.

​  # - pars1[5] = T0 = age at which lambda is lambda0 (default 
                                                             ^

R/bd_loglik.R:76:73: style: Trailing whitespace is superfluous.

​  # . tdmodel == 2: stepwise decline following diversity-dependence when 
                                                                        ^

R/bd_loglik.R:77:7: style: Commented code should be removed.

​  #   extinction = 0
      ^~~~~~~~~~~~~~

R/bd_loglik.R:78:80: style: Trailing whitespace is superfluous.

​  # . tdmodel == 3: decline in speciation rate following deterministic logistic 
                                                                               ^

R/bd_loglik.R:80:1: style: Lines should not be more than 80 characters.

​  # . tdmodel == 4...8: change in speciation/extinction rate following ddmodel = 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:80:81: style: Trailing whitespace is superfluous.

​  # . tdmodel == 4...8: change in speciation/extinction rate following ddmodel = 
                                                                                ^

R/bd_loglik.R:82:1: style: Lines should not be more than 80 characters.

​  # - pars2[2] = cond = conditioning on age (0), non-extinction of the clade and 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:82:81: style: Trailing whitespace is superfluous.

​  # - pars2[2] = cond = conditioning on age (0), non-extinction of the clade and 
                                                                                ^

R/bd_loglik.R:86:79: style: Trailing whitespace is superfluous.

​  # - pars2[5] = likelihood is for a tree with crown age (2) or stem age (1) - 
                                                                              ^

R/bd_loglik.R:89:1: style: Trailing whitespace is superfluous.

​  
^~

R/bd_loglik.R:90:36: style: There should be a space between right parenthesis and an opening curly brace.

​  rhotaut <- function(tau, t1, pars){
                                   ^

R/bd_loglik.R:105:74: style: Trailing whitespace is superfluous.

​      rtt <- mu0 / mu1 * (exp(-mu1 * t1) - exp(-mu1 * tau)) - la0 / la1 * 
                                                                         ^

R/bd_loglik.R:110:1: style: Trailing whitespace is superfluous.

​  
^~

R/bd_loglik.R:111:3: style: Variable and function name style should be snake_case or symbols.

​  PtTint <- function(x, t1, pars){
  ^~~~~~

R/bd_loglik.R:111:33: style: There should be a space between right parenthesis and an opening curly brace.

​  PtTint <- function(x, t1, pars){
                                ^

R/bd_loglik.R:112:5: style: Variable and function name style should be snake_case or symbols.

​    PtTint <- pars[2] * exp(-pars[4] * x) * exp(rhotaut(x, t1, pars))
    ^~~~~~

R/bd_loglik.R:115:1: style: Trailing whitespace is superfluous.

​  
^~

R/bd_loglik.R:116:26: style: There should be a space between right parenthesis and an opening curly brace.

​  ff <- function(t1, pars){
                         ^

R/bd_loglik.R:117:54: style: Place a space before left parenthesis, except in a function call.

​    ff <- 1 / pars[3] + (1 / 2 - 1 / pars[3]) * exp(-(pars[1] - pars[2]) * t1)
                                                     ^

R/bd_loglik.R:120:1: style: Trailing whitespace is superfluous.

​  
^~

R/bd_loglik.R:121:40: style: There should be a space between right parenthesis and an opening curly brace.

​  exprhotaut2 <- function(tau, t1, pars){
                                       ^

R/bd_loglik.R:125:1: style: Trailing whitespace is superfluous.

​  
^~

R/bd_loglik.R:126:3: style: Variable and function name style should be snake_case or symbols.

​  intPtTint2 <- function(t1, T, pars){
  ^~~~~~~~~~

R/bd_loglik.R:126:30: style: Variable and function name style should be snake_case or symbols.

​  intPtTint2 <- function(t1, T, pars){
                             ^

R/bd_loglik.R:126:37: style: There should be a space between right parenthesis and an opening curly brace.

​  intPtTint2 <- function(t1, T, pars){
                                    ^

R/bd_loglik.R:127:5: style: Variable and function name style should be snake_case or symbols.

​    intPtTint2 <- pars[2] / ff(t1,pars) * 
    ^~~~~~~~~~

R/bd_loglik.R:127:35: style: Commas should always have a space after.

​    intPtTint2 <- pars[2] / ff(t1,pars) * 
                                  ^

R/bd_loglik.R:127:42: style: Trailing whitespace is superfluous.

​    intPtTint2 <- pars[2] / ff(t1,pars) * 
                                         ^

R/bd_loglik.R:128:11: style: Use TRUE instead of the symbol T.

​      ( (T - t1) / pars[3] + (ff(t1, pars) - ff(T, pars)) / 
         ~^

R/bd_loglik.R:128:50: style: Use TRUE instead of the symbol T.

​      ( (T - t1) / pars[3] + (ff(t1, pars) - ff(T, pars)) / 
                                                ~^

R/bd_loglik.R:128:60: style: Trailing whitespace is superfluous.

​      ( (T - t1) / pars[3] + (ff(t1, pars) - ff(T, pars)) / 
                                                           ^

R/bd_loglik.R:129:30: style: Do not place spaces around code in parentheses or square brackets.

​          (pars[1] - pars[2]) )
                             ^

R/bd_loglik.R:132:1: style: Trailing whitespace is superfluous.

​  
^~

R/bd_loglik.R:134:61: style: There should be a space between right parenthesis and an opening curly brace.

​  if (min(pars1) < 0 | (tdmodel == 4 & pars1[1] <= pars1[2])){
                                                            ^

R/bd_loglik.R:141:18: style: There should be a space between right parenthesis and an opening curly brace.

​    if (cond == 3){
                 ^

R/bd_loglik.R:147:24: style: There should be a space between right parenthesis and an opening curly brace.

​    if (is.na(pars2[6])){
                       ^

R/bd_loglik.R:148:16: style: Use <-, not =, for assignment.

​      pars2[6] = Inf
               ^

R/bd_loglik.R:150:1: style: Trailing whitespace is superfluous.

​    
^~~~

R/bd_loglik.R:151:32: style: There should be a space between right parenthesis and an opening curly brace.

​    if (soc == 1 & tdmodel == 2){
                               ^

R/bd_loglik.R:152:30: style: Commas should always have a space after.

​      pars1new <- c(pars1[1],1e-10,pars1[3])
                             ^

R/bd_loglik.R:152:36: style: Commas should always have a space after.

​      pars1new <- c(pars1[1],1e-10,pars1[3])
                                   ^

R/bd_loglik.R:153:1: style: Lines should not be more than 80 characters.

​      pars2new <- c(min(10 * (1 + missnumspec + length(brts)),1000),1,pars2[2:5])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:153:63: style: Commas should always have a space after.

​      pars2new <- c(min(10 * (1 + missnumspec + length(brts)),1000),1,pars2[2:5])
                                                              ^

R/bd_loglik.R:153:69: style: Commas should always have a space after.

​      pars2new <- c(min(10 * (1 + missnumspec + length(brts)),1000),1,pars2[2:5])
                                                                    ^

R/bd_loglik.R:153:71: style: Commas should always have a space after.

​      pars2new <- c(min(10 * (1 + missnumspec + length(brts)),1000),1,pars2[2:5])
                                                                      ^

R/bd_loglik.R:154:1: style: Lines should not be more than 80 characters.

​      loglik <- dd_loglik(pars1 = pars1new, pars2 = pars2new, brts = brts, missnumspec = missnumspec, methode = methode)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:154:17: warning: no visible global function definition for ‘dd_loglik’

​      loglik <- dd_loglik(pars1 = pars1new, pars2 = pars2new, brts = brts, missnumspec = missnumspec, methode = methode)
                ^~~~~~~~~

R/bd_loglik.R:156:12: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​    } else {        
           ^

R/bd_loglik.R:156:13: style: Trailing whitespace is superfluous.

​    } else {        
            ^~~~~~~~

R/bd_loglik.R:158:34: style: There should be a space between right parenthesis and an opening curly brace.

​      if (brts[length(brts)] == 0){
                                 ^

R/bd_loglik.R:162:10: style: Place a space before left parenthesis, except in a function call.

​      for(i in 2:length(brts2)) {
         ^

R/bd_loglik.R:163:37: style: There should be a space between right parenthesis and an opening curly brace.

​        if (brts2[i] == brts2[i - 1]){
                                    ^

R/bd_loglik.R:167:19: style: There should be a space between right parenthesis and an opening curly brace.

​      if (soc == 2){
                  ^

R/bd_loglik.R:170:7: style: Variable and function name style should be snake_case or symbols.

​      TT <- brts[1]
      ^~

R/bd_loglik.R:172:1: style: Trailing whitespace is superfluous.

​      
^~~~~~

R/bd_loglik.R:173:7: style: Variable and function name style should be snake_case or symbols.

​      S <- length(brts)
      ^

R/bd_loglik.R:174:7: style: Variable and function name style should be snake_case or symbols.

​      N <- S + m
      ^

R/bd_loglik.R:176:7: style: Variable and function name style should be snake_case or symbols.

​      PtT <- rep(0, S)
      ^~~

R/bd_loglik.R:178:1: style: Trailing whitespace is superfluous.

​      
^~~~~~

R/bd_loglik.R:179:7: warning: local variable ‘abstol’ assigned but may not be used

​      abstol <- 1e-16
      ^~~~~~

R/bd_loglik.R:180:7: warning: local variable ‘reltol’ assigned but may not be used

​      reltol <- 1e-10
      ^~~~~~

R/bd_loglik.R:181:1: style: Trailing whitespace is superfluous.

​      
^~~~~~

R/bd_loglik.R:182:7: style: Variable and function name style should be snake_case or symbols.

​      T0 <- TT
      ^~

R/bd_loglik.R:185:28: style: There should be a space between right parenthesis and an opening curly brace.

​      if (length(pars1) > 2){
                           ^

R/bd_loglik.R:187:9: style: Variable and function name style should be snake_case or symbols.

​        K <- pars1[3]
        ^

R/bd_loglik.R:189:31: style: There should be a space between right parenthesis and an opening curly brace.

​        if (length(pars1) == 5){
                              ^

R/bd_loglik.R:190:11: style: Variable and function name style should be snake_case or symbols.

​          T0 <- pars1[5]
          ^~

R/bd_loglik.R:191:10: style: Trailing whitespace is superfluous.

​        } 
         ^

R/bd_loglik.R:194:9: style: Variable and function name style should be snake_case or symbols.

​        K <- Inf
        ^

R/bd_loglik.R:196:31: style: Commas should always have a space after.

​        pars1 <- c(pars1, c(0,0))
                              ^

R/bd_loglik.R:198:1: style: Trailing whitespace is superfluous.

​      
^~~~~~

R/bd_loglik.R:199:9: style: Place a space before left parenthesis, except in a function call.

​      if(tdmodel == 1){
        ^

R/bd_loglik.R:199:22: style: There should be a space between right parenthesis and an opening curly brace.

​      if(tdmodel == 1){
                     ^

R/bd_loglik.R:203:1: style: Trailing whitespace is superfluous.

​      
^~~~~~

R/bd_loglik.R:205:1: style: Trailing whitespace is superfluous.

​      
^~~~~~

R/bd_loglik.R:206:9: style: Place a space before left parenthesis, except in a function call.

​      if(tdmodel == 0 | (tdmodel == 1 & la1 == 0 & mu1 == 0))
        ^

R/bd_loglik.R:207:7: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​      {
      ^

R/bd_loglik.R:208:11: style: Place a space before left parenthesis, except in a function call.

​        if(abs(la0 - mu0) < 1E-10){
          ^

R/bd_loglik.R:208:34: style: There should be a space between right parenthesis and an opening curly brace.

​        if(abs(la0 - mu0) < 1E-10){
                                 ^

R/bd_loglik.R:210:11: style: Variable and function name style should be snake_case or symbols.

​          PtT <- 1 / (1 + lamu * (TT - t))
          ^~~

R/bd_loglik.R:213:11: style: Variable and function name style should be snake_case or symbols.

​          PtT <- (la0 - mu0) / (la0 - mu0 * exp(-(la0 - mu0) * (TT - t)))
          ^~~

R/bd_loglik.R:213:50: style: Place a space before left parenthesis, except in a function call.

​          PtT <- (la0 - mu0) / (la0 - mu0 * exp(-(la0 - mu0) * (TT - t)))
                                                 ^

R/bd_loglik.R:214:29: style: Place a space before left parenthesis, except in a function call.

​      ux <- la0 * (1 - exp(-(la0 - mu0) * (TT - t))) /
                            ^

R/bd_loglik.R:215:27: style: Place a space before left parenthesis, except in a function call.

​        (la0 - mu0 * exp(-(la0 - mu0) * (TT - t)))
                          ^

R/bd_loglik.R:218:47: style: There should be a space between right parenthesis and an opening curly brace.

​      if (tdmodel == 1 & (la1 != 0 | mu1 != 0)){
                                              ^

R/bd_loglik.R:219:12: style: Place a space before left parenthesis, except in a function call.

​        for(i in 1:S){
           ^

R/bd_loglik.R:221:46: style: Trailing whitespace is superfluous.

​            PtTint, lower = t[i], upper = TT, 
                                             ^

R/bd_loglik.R:226:30: style: There should be a space between right parenthesis and an opening curly brace.

​      } else if (tdmodel == 2){
                             ^

R/bd_loglik.R:227:27: style: There should be a space between right parenthesis and an opening curly brace.

​        if (N > ceiling(K)){
                          ^

R/bd_loglik.R:231:22: style: Commas should always have a space after.

​        la <- pmax(0,la0 * (1 - (2:S) / K))
                     ^

R/bd_loglik.R:232:33: style: Commas should always have a space after.

​        dx <- c(abs(diff(brts)),brts[S])[2:S]
                                ^

R/bd_loglik.R:233:11: style: Commented code should be removed.

​        # mpfr(la, precBits = 500)
          ^~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:234:11: style: Commented code should be removed.

​        # mpfr(dx, precBits = 500)
          ^~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:236:9: style: Variable and function name style should be snake_case or symbols.

​        PtT <- rep(1,S)
        ^~~

R/bd_loglik.R:236:22: style: Commas should always have a space after.

​        PtT <- rep(1,S)
                     ^

R/bd_loglik.R:237:12: style: Place a space before left parenthesis, except in a function call.

​        for(i in 2:S){
           ^

R/bd_loglik.R:241:30: style: There should be a space between right parenthesis and an opening curly brace.

​      } else if (tdmodel == 3){
                             ^

R/bd_loglik.R:242:9: style: Variable and function name style should be snake_case or symbols.

​        PtT <- 1 / (1 + intPtTint2(t, TT, pars1))
        ^~~

R/bd_loglik.R:244:30: style: There should be a space between right parenthesis and an opening curly brace.

​      } else if (tdmodel == 4){
                             ^

R/bd_loglik.R:245:9: style: Variable and function name style should be snake_case or symbols.

​        Kprime <- la0 / (la0 - mu0) * K
        ^~~~~~

R/bd_loglik.R:248:32: style: Trailing whitespace is superfluous.

​          ceiling(Kprime) < N | 
                               ^

R/bd_loglik.R:249:39: style: Trailing whitespace is superfluous.

​          K >= 0.9 * round(pars2[6]) | 
                                      ^

R/bd_loglik.R:250:18: style: Trailing whitespace is superfluous.

​          K < 1 | 
                 ^

R/bd_loglik.R:251:22: style: Trailing whitespace is superfluous.

​          la0 < mu0 | 
                     ^

R/bd_loglik.R:253:9: style: There should be a space between right parenthesis and an opening curly brace.

​        ){
        ^

R/bd_loglik.R:262:25: style: Trailing whitespace is superfluous.

​        latd[1] <- mu0 + 
                        ^

R/bd_loglik.R:264:12: style: Place a space before left parenthesis, except in a function call.

​        for(k in 2:np){
           ^

R/bd_loglik.R:268:1: style: Lines should not be more than 80 characters.

​          #y2 = deSolve::ode(variables, c(t1, t2), td_loglik_rhs, c(pars1[1:min(4, length(pars1))], tdmodel - 3, lx), rtol = 1e-10, atol = 1e-16, method = methode)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:268:12: style: Commented code should be removed.

​          #y2 = deSolve::ode(variables, c(t1, t2), td_loglik_rhs, c(pars1[1:min(4, length(pars1))], tdmodel - 3, lx), rtol = 1e-10, atol = 1e-16, method = methode)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:285:19: style: Only use double-quotes.

​              cat('NA or NaN issues encountered.\n')
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:290:15: style: Place a space before left parenthesis, except in a function call.

​            if(verbose) cat('Probabilities smaller than 0 encountered\n')
              ^

R/bd_loglik.R:290:29: style: Only use double-quotes.

​            if(verbose) cat('Probabilities smaller than 0 encountered\n')
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:292:35: style: Commas should always have a space after.

​            variables <- rep(-Inf,length(variables))
                                  ^

R/bd_loglik.R:293:12: style: Trailing whitespace is superfluous.

​          } 
           ^

R/bd_loglik.R:294:12: style: Commented code should be removed.

​          #variables2 = y2[2, 2:(lx + k)]
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:296:13: style: Trailing whitespace is superfluous.

​          #{ 
            ^

R/bd_loglik.R:297:15: style: Commented code should be removed.

​          #   print(variables2 - variables)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:298:15: style: Commented code should be removed.

​          #   unequal <- which(variables != variables2)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:299:14: style: Commented code should be removed.

​          #  if(length(unequal) > 0) stop('Stop here')
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:303:11: style: Variable and function name style should be snake_case or symbols.

​          dEN_dt <- (la0 - mu0) * expn[k] - expn2 * (la0 - mu0) / K
          ^~~~~~

R/bd_loglik.R:306:40: style: Do not place spaces around code in parentheses or square brackets.

​        if (sum(variables[1:lx]) < 0.99 ) {
                                       ^

R/bd_loglik.R:307:12: style: Commented code should be removed.

​          #print(lx)
           ^~~~~~~~~

R/bd_loglik.R:308:12: style: Commented code should be removed.

​          #print(sum(variables[1:lx]))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:309:15: style: Only use double-quotes.

​          cat('Leaking probabilities detected.')
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:313:9: style: Variable and function name style should be snake_case or symbols.

​        PtT <- 1 / (1 + sig)
        ^~~

R/bd_loglik.R:316:11: style: Variable and function name style should be snake_case or symbols.

​          PtT <- c(PtT[1], PtT)
          ^~~

R/bd_loglik.R:320:1: style: Trailing whitespace is superfluous.

​      
^~~~~~

R/bd_loglik.R:322:11: style: Place a space before left parenthesis, except in a function call.

​        if(tdmodel == 0) {
          ^

R/bd_loglik.R:324:34: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​        } else if (tdmodel == 1) { 
                                 ^

R/bd_loglik.R:324:35: style: Trailing whitespace is superfluous.

​        } else if (tdmodel == 1) { 
                                  ^

R/bd_loglik.R:328:18: style: Place a space before left parenthesis, except in a function call.

​        } else if(tdmodel == 3) {
                 ^

R/bd_loglik.R:330:18: style: Place a space before left parenthesis, except in a function call.

​        } else if(tdmodel == 4) {
                 ^

R/bd_loglik.R:333:9: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​        {
        ^

R/bd_loglik.R:334:16: style: Only use double-quotes.

​          stop('The tdmodel you selected does not exist. Please check pars2.')
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:336:20: style: There should be a space between right parenthesis and an opening curly brace.

​        if (S > soc){
                   ^

R/bd_loglik.R:337:64: style: Trailing whitespace is superfluous.

​          loglik <- loglik + sum(log(lavec[soc:length(lavec)])) 
                                                               ^

R/bd_loglik.R:340:1: style: Trailing whitespace is superfluous.

​      
^~~~~~

R/bd_loglik.R:342:9: style: Place a space before left parenthesis, except in a function call.

​      if(cond == 1) {
        ^

R/bd_loglik.R:343:14: style: Use <-, not =, for assignment.

​        logp = soc * log(PtT[1])
             ^

R/bd_loglik.R:345:9: style: Place a space before left parenthesis, except in a function call.

​      if(cond == 2 | cond == 3) {
        ^

R/bd_loglik.R:346:11: style: Place a space before left parenthesis, except in a function call.

​        if(tdmodel == 2) {
          ^

R/bd_loglik.R:348:11: style: Variable and function name style should be snake_case or symbols.

​          K2 <- K
          ^~

R/bd_loglik.R:349:39: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​          if (floor(K) == ceiling(K)) { 
                                      ^

R/bd_loglik.R:349:40: style: Trailing whitespace is superfluous.

​          if (floor(K) == ceiling(K)) { 
                                       ^

R/bd_loglik.R:350:13: style: Variable and function name style should be snake_case or symbols.

​            K2 <- K + eps
            ^~

R/bd_loglik.R:351:52: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​          } else if (floor(K + eps) == ceiling(K)) { 
                                                   ^

R/bd_loglik.R:351:53: style: Trailing whitespace is superfluous.

​          } else if (floor(K + eps) == ceiling(K)) { 
                                                    ^

R/bd_loglik.R:352:13: style: Variable and function name style should be snake_case or symbols.

​            K2 <- K - eps
            ^~

R/bd_loglik.R:354:13: style: Variable and function name style should be snake_case or symbols.

​            K2 <- K + eps
            ^~

R/bd_loglik.R:364:12: style: Commented code should be removed.

​          #pB = max(50,round(3/la0))
           ^~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:365:12: style: Commented code should be removed.

​          #s = mpfr(s, precBits = pB)      
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:365:38: style: Trailing whitespace is superfluous.

​          #s = mpfr(s, precBits = pB)      
                                     ^~~~~~

R/bd_loglik.R:366:12: style: Commented code should be removed.

​          #sgnsdiff = mpfr(sgnsdiff, precBits = pB)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:367:12: style: Commented code should be removed.

​          #logsdiff = mpfr(logsdiff, precBits = pB)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:368:12: style: Commented code should be removed.

​          #sgnsdiff2 = mpfr(sgnsdiff2, precBits = pB)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:369:12: style: Commented code should be removed.

​          #logsdiff2 = mpfr(logsdiff2, precBits = pB)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:370:12: style: Commented code should be removed.

​          #logsdiff3 = mpfr(logsdiff3, precBits = pB)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:372:26: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​          for (i in 1:N) { 
                         ^

R/bd_loglik.R:372:27: style: Trailing whitespace is superfluous.

​          for (i in 1:N) { 
                          ^

R/bd_loglik.R:373:45: style: Commas should always have a space after.

​            sgnsdiff[i] <- prod(sign(s[-c(1,i)] - s[i]))
                                            ^

R/bd_loglik.R:374:47: style: Commas should always have a space after.

​            logsdiff[i] <- sum(log(abs(s[-c(1,i)] - s[i])))
                                              ^

R/bd_loglik.R:377:50: style: Put spaces around all infix operators.

​            logsdiff3[i] <- -sum(log(abs(1 - s[i]/s[-c(1,i,N)]))) - 
                                                ~^~

R/bd_loglik.R:377:58: style: Commas should always have a space after.

​            logsdiff3[i] <- -sum(log(abs(1 - s[i]/s[-c(1,i,N)]))) - 
                                                         ^

R/bd_loglik.R:377:60: style: Commas should always have a space after.

​            logsdiff3[i] <- -sum(log(abs(1 - s[i]/s[-c(1,i,N)]))) - 
                                                           ^

R/bd_loglik.R:377:68: style: Trailing whitespace is superfluous.

​            logsdiff3[i] <- -sum(log(abs(1 - s[i]/s[-c(1,i,N)]))) - 
                                                                   ^

R/bd_loglik.R:382:77: style: Trailing whitespace is superfluous.

​            #         logp <- sum(log(s[2:(N-1)])) + log(sum(sgnsdiff[2:N] * 
                                                                            ^

R/bd_loglik.R:384:1: style: Lines should not be more than 80 characters.

​            #         logp <- log(sum(sgnsdiff[2:N] * exp(sum(log(s[2:(N-1)])) - 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:384:81: style: Trailing whitespace is superfluous.

​            #         logp <- log(sum(sgnsdiff[2:N] * exp(sum(log(s[2:(N-1)])) - 
                                                                                ^

R/bd_loglik.R:388:35: style: Put spaces around all infix operators.

​            logp <- sum(log(s[1:(N-1)])) + 
                                 ~^~

R/bd_loglik.R:388:43: style: Trailing whitespace is superfluous.

​            logp <- sum(log(s[1:(N-1)])) + 
                                          ^

R/bd_loglik.R:393:13: style: Place a space before left parenthesis, except in a function call.

​          if(cond == 2) {
            ^

R/bd_loglik.R:394:70: style: Trailing whitespace is superfluous.

​            logp <- (soc == 2) * log(S + m - 1) + soc * log(PtT[1]) + 
                                                                     ^

R/bd_loglik.R:397:57: style: Trailing whitespace is superfluous.

​            logp <- log(PtT[1]) - log(S + missnumspec) - 
                                                        ^

R/bd_loglik.R:402:1: style: Trailing whitespace is superfluous.

​      
^~~~~~

R/bd_loglik.R:404:1: style: Trailing whitespace is superfluous.

​      
^~~~~~

R/bd_loglik.R:406:11: style: Place a space before left parenthesis, except in a function call.

​        if(tdmodel == 2) {
          ^

R/bd_loglik.R:408:60: style: Trailing whitespace is superfluous.

​            "Missing species in diversity-dependence models 
                                                           ^

R/bd_loglik.R:413:11: style: Place a space before left parenthesis, except in a function call.

​        if(cond == 3) {
          ^

R/bd_loglik.R:414:33: style: Put spaces around all infix operators.

​          x <- (1 - ux[1]^((0:m)+1)) / (1 - ux[1])
                               ~^~

R/bd_loglik.R:418:12: style: Place a space before left parenthesis, except in a function call.

​        for(j in 2:S) {
           ^

R/bd_loglik.R:419:1: style: Lines should not be more than 80 characters.

​          #x = convolve(x,rev((1:(m + 1)) * ux[j]^(0:m)),type = 'open')[1:(m + 1)]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:419:12: style: Commented code should be removed.

​          #x = convolve(x,rev((1:(m + 1)) * ux[j]^(0:m)),type = 'open')[1:(m + 1)]
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:420:16: warning: no visible global function definition for ‘conv’

​          x <- conv(x, (1:(m + 1)) * ux[j]^(0:m))[1:(m+1)]
               ^~~~

R/bd_loglik.R:420:55: style: Put spaces around all infix operators.

​          x <- conv(x, (1:(m + 1)) * ux[j]^(0:m))[1:(m+1)]
                                                     ~^~

R/bd_loglik.R:422:59: style: Trailing whitespace is superfluous.

​        loglik <- loglik + lgamma(S + 1) + lgamma(m + 1) - 
                                                          ^

R/bd_loglik.R:424:1: style: Lines should not be more than 80 characters.

​        #loglik = loglik - log(S + m + 1) + log(S + 1) + log(S + m - 1) - log(S - 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:424:10: style: Commented code should be removed.

​        #loglik = loglik - log(S + m + 1) + log(S + 1) + log(S + m - 1) - log(S - 1)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:427:11: style: Place a space before left parenthesis, except in a function call.

​        if(tdmodel == 0) {
          ^

R/bd_loglik.R:428:25: style: Only use double-quotes.

​          s1 <- sprintf('Parameters: %f %f', pars1[1], pars1[2])
                        ^~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:431:13: style: Only use double-quotes.

​            'Parameters: %f %f %f %f', pars1[1], pars1[2], pars1[3], pars1[4]
            ^~~~~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:434:25: style: Only use double-quotes.

​          s1 <- sprintf('Parameters: %f %f %f', pars1[1], pars1[2], pars1[3])
                        ^~~~~~~~~~~~~~~~~~~~~~

R/bd_loglik.R:436:23: style: Only use double-quotes.

​        s2 <- sprintf(', Loglikelihood: %f', loglik)
                      ^~~~~~~~~~~~~~~~~~~~~

R/bd_ML.R:3:3: style: Trailing whitespace is superfluous.

​#' 
  ^

R/bd_ML.R:8:3: style: Trailing whitespace is superfluous.

​#' 
  ^

R/bd_ML.R:14:3: style: Trailing whitespace is superfluous.

​#' 
  ^