Biocro: Suppress "no visible binding" messages in package check output#1620
Biocro: Suppress "no visible binding" messages in package check output#1620mdietze merged 8 commits intoPecanProject:developfrom
Conversation
...These ARE no-ops, right? Please check my work carefully.
| if ("Sp" %in% trait.names) { | ||
| trait.samples <- transform(trait.samples, Sp = udunits2::ud.convert(Sp, "kg/m2", "g/cm2")) | ||
| } | ||
| if ("vmax" %in% trait.names) { |
There was a problem hiding this comment.
FWIW the following HAAAKs don't don't do anything. They were originally introduced in ecee6fd#diff-fb09778b34d1b5614bf2c73c9b2b0591 to account for bugs in the biocro code by rescaling Rd and vmax. When the bug was resolved I removed the scaling in 4b0340b but should have just removed these lines alltogether.
There was a problem hiding this comment.
So OK to merge - thanks for catching this @infotroph!
| if (met[, max(relative_humidity) > 1]) { | ||
| met[, `:=`(relative_humidity = relative_humidity/100)] | ||
| if (met[, max(met$relative_humidity) > 1]) { | ||
| met$relative_humidity = met$relative_humidity/100 |
There was a problem hiding this comment.
FWIW I think 'data.table' way was faster, as would the dplyr mutate function, though this is definitely more standard and readable.
| SolarR = ppfd, | ||
| Temp = udunits2::ud.convert(air_temperature, "Kelvin", "Celsius"), | ||
| RH = relative_humidity, | ||
| Temp = udunits2::ud.convert(met$air_temperature, "Kelvin", "Celsius"), |
There was a problem hiding this comment.
Is the met$ necessary? Why is it used for some variables but not others (like wind_speed and ppfd)?
|
Thanks for cleaning this up. The only thing I would suggest is to use consistent style - using the PS The data.table author Matt Dowle and Hadley consider this a problem with R CMD Check. Here is a discussion of the issue: https://stackoverflow.com/questions/9439256/how-can-i-handle-r-cmd-check-no-visible-binding-for-global-variable-notes-when |
Description
Fixes an annoying and potentially-problem-obscuring volume of NOTEs about "no visible binding for global variable" in the devtools::check() output. This is the last remaining item to close #1309.
The root cause of these notes is that the check doesn't know about nonstandard evaluation inside data.table calls. In #1309 I claimed the changes needed to fix these would make the code "WAY uglier", but now I don't think this is so bad.
Please check my deletion in acbaa51 -- I can't see any way these tranforms aren't no-ops, but the "HAAAACK" comments make me suspect they were there for a reason. @dlebauer do you remember what these calls were supposed to do?
Motivation and Context
Types of changes
Checklist: