Re: [R] passing arguments to simple plotting program.

2017-05-09 Thread Gerard Smits
Seems so simple when you explain it. Thanks very much. Gerard > On May 9, 2017, at 9:40 AM, Ulrik Stervbo wrote: > > Hi Gerard, > Quotation marks are used for strings. In you function body you try to use the > strings "indata" and "fig_descrip" (the latter will work

Re: [R] passing arguments to simple plotting program.

2017-05-09 Thread Gerard Smits
Hi Ulrik, If I can trouble you with one more question. Now trying to send a string to the main= . I was able to pass the data name in data=in_data, but same logic is not working in passion the main string. plot_f1 <-function(indata,n1,n2,n3,fig_descrip) { par(oma=c(2,2,2,2))

Re: [R] passing arguments to simple plotting program.

2017-05-09 Thread Gerard Smits
Hi Ulrik, That worked perfectly. Thanks for your help. Much appreciated. Gerard > On May 8, 2017, at 11:40 PM, Ulrik Stervbo wrote: > > HI Gerard, > > You get the literals because the variables are not implicitly expanded - > 'Placebo(N=n1) ' is just a string

Re: [R] passing arguments to simple plotting program.

2017-05-09 Thread Ulrik Stervbo
Hi Gerard, Quotation marks are used for strings. In you function body you try to use the strings "indata" and "fig_descrip" (the latter will work but is not what you want). In your current function call you pass the variable Figure as the value to the argument fig_descrip, followed by a lot of

Re: [R] passing arguments to simple plotting program.

2017-05-09 Thread Ulrik Stervbo
HI Gerard, You get the literals because the variables are not implicitly expanded - 'Placebo(N=n1) ' is just a string indicating the N = n1. What you want is to use paste() or paste0(): c(paste0("Placebo(N=", n1, ")"), paste0("Low Dose (N=", n2, ")"), paste0("High Dose (N=", n3, ")")) should do

[R] passing arguments to simple plotting program.

2017-05-08 Thread Gerard Smits
Hi All, I thought I’d try to get a function working instead of block copying code and editing. My backorund is more SAS, so using a SAS Macro would be easy, but not so lucky with R functions. R being used on Mac Sierra 10.12.4: R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C)