Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot find function 'melt' #8

Open
bsaul opened this issue Apr 11, 2016 · 2 comments
Open

cannot find function 'melt' #8

bsaul opened this issue Apr 11, 2016 · 2 comments

Comments

@bsaul
Copy link

bsaul commented Apr 11, 2016

I've run into the issue a few times, where when I call simobs get a cannot find function 'melt' error. When I run library(data.table), the issue goes away. I have not pinpointed if I have other libraries load that may cause the conflict, but I think changing melt to data.table::melt on line 749 of simulation.R may fix the issue. Though I see that data.table::melt has been commented out.

@osofr
Copy link
Owner

osofr commented Apr 11, 2016

Hi Bradley,
Thanks for filing this, but I can't replicate your issue. Is it possible that you don't have the latest version of data.table installed? Another possibility is that you may have reshape2 loaded in your environment, but I wouldn't expect that to cause an issue. data.table::melt had to be replaced with melt() to pass CRAN checks since data.table now exports its own S3 generic for melt, which might clash with the S3 generic for melt that is also exported by reshape2...

    library("simcausal"); options(simcausal.verbose=FALSE)
    t_end <- 5
    D <- DAG.empty() +
      node("W", distr="rbern", prob=0.05) +
      node("L1", t=0:t_end, distr="rbern", prob=0.25) +
      node("L2", t=0:t_end, distr="rconst", const=L1[t] + W) +
      node("Y",  t=0:t_end,  distr="rbern", prob=plogis(-6.5 + L1[t] + 2*L2[t] + 0.05*sum(I(L2[0:t]==rep(0,(t+1))))), EFU=TRUE)
    Dset <- set.DAG(D)
    Odat1 <- sim(Dset, n=500, wide = TRUE, rndseed = 123)
    Odat1 <- simobs(Dset, n=500, wide = TRUE, rndseed = 123)
    Odat1 <- sim(Dset, n=500, wide = FALSE, rndseed = 123)
    Odat1 <- simobs(Dset, n=500, wide = FALSE, rndseed = 123)

@bsaul
Copy link
Author

bsaul commented Apr 11, 2016

It may be a reshape2 issue, though I haven't add that package loaded when I've had the issue. I'll try to come up with a reproducible example, but it's not high priority.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants