-
Notifications
You must be signed in to change notification settings - Fork 6
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
Get rid of warnings and notes in R CMD check #338
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0067297
Get rid of warnings and notes in R CMD check
IndrajeetPatil bff2c22
Merge branch 'develop' into 162_get_rid_of_warnings
IndrajeetPatil 9ef0511
Merge branch 'develop' into 162_get_rid_of_warnings
IndrajeetPatil d0a0ad5
Merge branch 'develop' into 162_get_rid_of_warnings
IndrajeetPatil af9bb6c
Merge branch 'develop' into 162_get_rid_of_warnings
IndrajeetPatil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# defining global variables and functions to appease R CMD Check | ||
|
||
utils::globalVariables( | ||
names = c( | ||
".", | ||
"color", | ||
"fill", | ||
"fillLength", | ||
"linetype", | ||
"linetypeLength", | ||
"newPlotObject", | ||
"shape", | ||
"size" | ||
), | ||
package = "tlf", | ||
add = FALSE | ||
) | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to understand where those global varibales are defined - and failed.
E.g. "fillLength":
TLF-Library/R/plot-timeprofile.R
Lines 104 to 109 in 87f42c2
The comment says "fillLength defined in .parseUpdateAestheticProperty" - but there is no such definition in
.parseUpdateAestheticProperty
- and also not elsewhere in the code.TLF-Library/R/aaa-utilities.R
Lines 84 to 98 in 87f42c2
I am very confused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that comment is outdated.
As mentioned in this NOTE:
This unquoted symbol or name appears in the code, but it is not defined anywhere, and so R CMD Check complaints.
This is a common problem with non-standard evaluation, and I am using the standard solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref: https://r-pkgs.org/check.html#sec-check-checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, maybe it's just my very limited understanding of R, but I just don't get how you can use undefined variable? It must be defined somewhere, or not?
Where does the value of
fillLength
come from in the piece of code above?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thx anyway.
@pchelle Can you explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IINM, he is on vacation this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay.
The variable
fillLength
is created during the call of.parseUpdateAestheticProperty
when input argument is"fill"
To prevent potential copy/paste issues of very similar lines of code, most of the functions from
aaa-utilities.R
directly output R code as character strings (which are then transformed into expressions to be evaluated as actual R code usingparse(text)
andeval(expression)
.Below shows the expression returned when the function
.parseUpdateAestheticProperty
is called with the arguments "fill" andribbons
.When the expression is wrapped by
eval()
, this code is evaluated andfillVariable
, column name in the data linked to thefill
propertyfillLength
, number of unique values for thefill
property (used for selecting the right number of colors)fill
properties of the plotplotObject
Note that changing
"fill"
by any other property name such as"color"
or"alpha"
would directly create an evaluated R code with all the property names changed to"color"
or"alpha"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the warning in R-CMD-Check is from the function
plotTimeProfile
which needs to manage between the aesthetic properties of errorbars, scatter points, ribbons and lines while potentially sharing thecolor
aesthetic property.The
plotTimeProfile
code was leveraging the creation of thefillLength
property created by a previous call of.parseUpdateAestheticProperty
to merge thefill
property of both simulated and observed data.Since there is no actual written code of
fillLength <- length(unique(mapData[, fillVariable]))
(because created and run from the expression), the check flags the variablefillLength
as not being created before its use.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, now I at least understand how it works :)
I have further questions/thoughts regarding this, but I will create separate issues for that.
Accepting the PR for now.