R Custom Function - include argument value in title -
I have written a basic custom function to create some charts:
gw_chart & lt ; Qualct (variable, main = ("QQ-plot")} function (variable) {hist (variable, pro = t) line (density (variable, no.m.m = t) / code> When I type gw_chart (age) , where the age is a variable in the dataframe, the function produces two charts, but the title of the histogram is based on that default hist < / Code> - & gt; "Histogram of Variable", and xlabel is variable. How do I get the value of variable - In case: Age - Can be displayed instead?
And I would also like to customize the title of qqplot.
Thanks
gw_chart & lt; - function (variable) {laboratory <- deparse (substitute (variable) hist (variable, prob = t) Line (density (variable, no. Rm = t) rug (jitter (variable) qqPlot (variable, main = paste ("copy of", laboratory)), main = paste ("histogram of", lab)
Comments
Post a Comment