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

Ensure all equations contain valid R code #38

Closed
maurolepore opened this issue Mar 21, 2018 · 7 comments
Closed

Ensure all equations contain valid R code #38

maurolepore opened this issue Mar 21, 2018 · 7 comments

Comments

@maurolepore
Copy link
Member

maurolepore commented Mar 21, 2018

I plan to write a test to automatically check that each equation can be evaluated -- i.e. that it contains valid R code. Once that is done, we'll be able to press Control + Shift + T to run this (and all other) test, and we'll get an informative error message if some equation isn't valid R code.

@maurolepore
Copy link
Member Author

@gonzalezeb, here I point to some equations that currently contain invalid code and I suggest the solutions. Let me know if you have questions or need help.

@maurolepore
Copy link
Member Author

image

@maurolepore maurolepore changed the title Test that each equation contains valid R code Ensure all equations contain valid R code May 9, 2018
@gonzalezeb
Copy link
Contributor

This is great Mauro. Two fixes can be applied now and I will work on the other two:

fix_problem("attempt", "([0-9])(\(log10)", "\1 * \2")
fix_problem("unexpected ')'", "\)$", "")

A questions for you: I would like the changes to be applied to our master table (data-raw/allodb-master) but as the code is written now changes would be applied to data/equations. How do I work around it?

@maurolepore
Copy link
Member Author

You are right, the equations come from the equation table, and the changes are not applied back to any table.

eqn <- equations$equation_allometry`.

You could do something like this:

# Inputs a vector and outputs a dataframe
fixed_dataframe <- fix_problem(master$equations, ...)

master$equations <- fixed_dataframe$equations

This kind of "find and replace" you could also do in excel. But go for it if you want to do it in R. I think it's the best way to learn.

@gonzalezeb
Copy link
Contributor

I reviewed and fixed the equations (the easiest way!). thanks Mauro. For dba or what I call, the srub problem please see issue #41

@maurolepore
Copy link
Member Author

maurolepore commented May 24, 2018

(Details.)

Great work @gonzalezeb; thanks!

Now all except one error relates to 'dba', which I'll follow up in #41. The exception relates to 'BA'. I had missed this error before. What should we do about it?

image

@maurolepore
Copy link
Member Author

Relates to #54 .

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

No branches or pull requests

3 participants