Re: [R] Turning a Variable into String

2010-12-20 Thread Paolo Rossi
Thank you very much to the both of you Paolo On 20 December 2010 00:35, Duncan Murdoch wrote: > On 19/12/2010 7:21 PM, Paolo Rossi wrote: > >> I would like to know how to turn a variable into a string. I have tried >> as.symbol and as.name but it doesnt work for what I'd like to do >> >> Esse

Re: [R] Turning a Variable into String

2010-12-19 Thread Duncan Murdoch
On 19/12/2010 7:21 PM, Paolo Rossi wrote: I would like to know how to turn a variable into a string. I have tried as.symbol and as.name but it doesnt work for what I'd like to do Essentially, I'd like to feed the function below with two variables. This works fine in the bit working out number of

Re: [R] Turning a Variable into String

2010-12-19 Thread Phil Spector
Paolo - One way to make the function do what you want is to replace the line print(sprintf("OK with %s and %s\n", var1, var2)) with cat('OK with',substitute(var1),'and',substitute(var2),'\n') With sprintf, you'd need print(sprintf("OK with %s and %s\n", deparse(substitute(var1)), depa

[R] Turning a Variable into String

2010-12-19 Thread Paolo Rossi
I would like to know how to turn a variable into a string. I have tried as.symbol and as.name but it doesnt work for what I'd like to do Essentially, I'd like to feed the function below with two variables. This works fine in the bit working out number of elements in each variable. In the print(sp