MUCollective / multiverse

R package for creating explorable multiverse analysis
https://mucollective.github.io/multiverse/
GNU General Public License v3.0
62 stars 5 forks source link

Several functions won't load on multiverse version 0.5.0 #95

Closed greg-fauerbach closed 3 years ago

greg-fauerbach commented 3 years ago

Hello,

I downloaded multiverse version 0.5.0 from CRAN, and the following functions aren't loading:

  1. branch()
  2. get_code()
  3. parse_multiverse()

When I attempt to call one of these functions, I get an error message, e.g: Error in branch() : could not find function "branch"

I don't get this issue with other functions, like execute_multiverse() or inside().

My system:

I'd love to use this package for a project--do you have any idea what the problem might be?

Thank you,

Greg

abhsarma commented 3 years ago

So there are seems to be two things going on here. parse_multiverse and get_code are package internals which you should not need to use in most cases (if you absolutely must use them then you can make a call like multiverse:::parse_multiverse although I 'd not recommend that. So the fact that these two are not available are by design.

For branch, it again is not an exported function, but you do need to use this in your syntax. branch is only treated as a function when we are parsing the user declared syntax. So branch needs to be used within a inside function if you are using RScript (i.e. .R file) or inside a multiverse code block if you are running the code in RMarkdown.

Let me know if that solves the issue. If not, could you post some code snippets of what you are trying to do so that I can diagnose the problem better? Thanks!

greg-fauerbach commented 3 years ago

Hello,

Thank you for your quick response.

That solves the issue. I was working through the example in readme.md, and I copy/pasted:

NextMenstrualOnset = branch(menstrual_calculation, "mc_option1" ~ StartDateofLastPeriod + ComputedCycleLength, "mc_option2" ~ StartDateofLastPeriod + ReportedCycleLength, "mc_option3" ~ StartDateNext )

... and wondered why it wouldn't run properly. I didn't realize I had to call branch within inside.

Thanks,

Greg