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

NSE-related? issue causing ev() to fail when column named amt #29

Closed
dpastoor opened this issue Apr 17, 2016 · 3 comments
Closed

NSE-related? issue causing ev() to fail when column named amt #29

dpastoor opened this issue Apr 17, 2016 · 3 comments

Comments

@dpastoor
Copy link
Contributor

fails with error Error: invalid subscript type 'double'

ex_df <- data.frame(rate = 10, amt=10)
ev(time = 0, amt = 10, rate = ex_df$amt)

works

ev(time = 0, amt = 10, rate = 10)

works

ex_df <- data.frame(rate = 10)
ev(time = 0, amt = 10, rate = ex_df$rate)

But does not fail with other (possible) keywords, as this works

ex_df <- data.frame(rate = 10, amt=10, ss=10)
ev(time = 0, amt = 10, rate = ex_df$ss)
@dpastoor
Copy link
Contributor Author

Occasion comes up when I want a 1 hr infusion so am setting rate = amt

@dpastoor
Copy link
Contributor Author

Ok, looks like this isn't directly an mrgsolve issue, it is actually a dplyr issue

The solution is to be careful about using $ in your commands (data[["amt"]] instead of data$amt)

I will keep the issue open now until @kylebmetrum decides whether this would be worthy of an additional note somewhere as I could see this occurance coming up again - maybe like a 'errors and solutions' document of sorts

@kylebaron
Copy link
Collaborator

I get that all the time with dplyr too. I'll drop the NSE altogether. It was an experiment and ended up not being that useful.

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