Installing "likelihood"

I'm doing a project with the "likelihood" package, which I installed using the install.packages() function. It appears in my package library like it should; however, the following chunk of code produces the error "there is no package called "likelihood". Does anyone know what the problem could be?

noreturn <- clusterEvalQ(cl, model1 <- function(dsn, don, dbn, dof, dbf, betas, lambdas) {
  
  disp <- betas[beta_ind] * (exp(-0.5*(log((distances + dsn)/don)/dbn)) + 
                               exp(-0.5*(log( distances       /dof)/dbf)))
  
  rowSums(disp, na.rm = T) * lambdas[lambda_ind]
})

noreturn <- clusterEvalQ(cl, library(likelihood))
1 Like

You just have to install packages once, but you have to load them on each new R session, so try loading the package before running your code with

library(likelihood)
1 Like

@audrey After installing the package likelihood, I was able to run the code below:

library(parallel)
cl <- makeCluster(getOption("cl.cores", 2))
noreturn <- clusterEvalQ(cl, library(likelihood))
stopCluster(cl)

Could you please try running this code and report the exact error message it returns?

Also, could you please confirm that you are able to run library(likelihood) directly in the R console?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.