Hello,
In the following code, the fixed parts of the plot are drawn first,
assigning the plot to p. Then geom_hline is conditionally added to p and
the result returned to caller.
This may be a problem if the conditional geom needs to be in a specified
order in the plot. Function plotLineFunc2
s till you print it and
it evaluates the data structure.
-Original Message-
From: R-help On Behalf Of p...@philipsmith.ca
Sent: Wednesday, March 24, 2021 10:24 PM
To: r-help@r-project.org
Subject: [R] Including a ggplot call with a conditional geom in a function
How can I write an R fu
How can I write an R function that contains a call to ggplot within it,
with one of the ggplot geom statements being conditional? In my reprex,
I want the plot to contain a horizontal zero line if the y values are
both positive and negative, and to exclude the horizontal line if all of
the y va
3 matches
Mail list logo