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(sprintf("OK with %s and %s\n", var1, var2))  line I would like
var1 and var2 to be magically substituted with a string containing the name
of var1 and name of var2.

Thanks in advance

Paolo



haveSameLength <- function(var1, var2) {
 if (length(var1)==length(var2))
  {
   print(sprintf("OK with %s and %s\n", var1, var2))
 } else {
   print("Problems!!")
 }
}

	[[alternative HTML version deleted]]

