[R] Text dependent on a variable in a R function
dwinsemius at comcast.net
Sun May 2 16:24:19 CEST 2010
On May 2, 2010, at 10:10 AM, Nikhil Kaza wrote:
> say x is the variable.
> plot(..., title=paste(x, "whatever else"), ...) should work as well.
> same should work with file names as well.
Perhaps in an alternate universe it might, ... but it doesn't in this
one. "title" is not the correct parameter for specifying titles, and
if you change the parameter name to the correct parameter name,
"main", you are now giving it a vector with text-coercion of the
number of values of x in x pasted to "whatever", since paste is
Not what you want:
x <-c(-1, -0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75, 1)
plot(x, main=paste(x, "whatever"))
> On May 1, 2010, at 9:56 PM, R K wrote:
>> I was wondering if someone could tell me how I can make text
>> dependent on a variable in a R function I have created.
>> The function will create plots, thus I would like each plot to have
>> a unique title based on the inputted variable as well as a unique
>> file name when saved using the savePlot function.
>> The New Busy is not the old busy. Search, chat and e-mail from your
>> [[alternative HTML version deleted]]
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT
More information about the R-help