Greg Snow <[email protected]> [Sat, Jun 19, 2010 at 12:44:48AM CEST]:
> There are a lot of other reasons to install the fortunes package that just
> the one fortune, there is much wisdom, some wit, (and then there are mine)
> throughout the package.
>
Sorry, but I am subscribing to r-help already. I could not possibly
handle more wisdom and wit than this.
> There could be other ways to accomplish your goals, if you let us know more
> about what you are trying to do, we may be able to help you find a better way
> (that does not mean that you cannot still use eval and parse, but you may
> learn something, and/or avoid future pitfalls).
Ok, I want to demonstrate for educational purposes how to construct a
set of rules to validate a set of clinical data, and to make it issue
and export appropriate query messages.
A rule would be a data structure containing the ID of the rule, the
rule in human readable language, an expression evaluating variables
within the environment of the appropriate data frame (and resolving to
a logical vector), possibly the data frame itself, and the query
message (possibly as an sprintf expression). The data structure may be
an S4 object or a list. In our current workflow, we manage the
validation rules using a spreadsheet, and import them into a
competitor's analysis software.
I could pass
function(df) with(df, (vsstresn < 30 | vsstresn > 130) & vstestcd == "HR")
as an argument, but "function(df) with(df," is sort of redundant, as I
expect it to be in every expression, plus it doesn't add much clarity
for the people writing and reading these conditions.
[...]
> Personally I have never regretted trying not to underestimate my own future
> stupidity.
> -- Greg Snow (explaining why eval(parse(...)) is often suboptimal,
> answering
> a question triggered by the infamous fortune(106))
> R-help (January 2007)
Don't get me started about my current stupidity.
--
Johannes Hüsing There is something fascinating about science.
One gets such wholesale returns of conjecture
mailto:[email protected] from such a trifling investment of fact.
http://derwisch.wikidot.com (Mark Twain, "Life on the Mississippi")
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.