Hello all,
I want to print out "call" from my function. When I have a long list
of
arguments or long names for them, I either got mulilines using default
print or big blank space using cat:
foo<- function(data, newdata)
{
call <- match.call();
cat("Call:\n");
print(call);
cat("\nCall:\n", deparse(call), "\n\n", fill=TRUE,
sep="")
cat("\nCall:\n", gsub("\t", " ",
deparse(call)), "\n\n", sep="")
}
> foo(data=A, newdata=alooooooooooooooooooooooooooooooooongname[,5:10])
Call:
foo(data = A, newdata = alooooooooooooooooooooooooooooooooongname[,
5:10])
Call:
foo(data = A, newdata = alooooooooooooooooooooooooooooooooongname[, 5:10])
Call:
foo(data = A, newdata = alooooooooooooooooooooooooooooooooongname[, 5:10])
Note the big space between , and 5.
> sessionInfo()
R version 2.7.2 (2008-08-25)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods
base>
print.lm behaves simimarly.
Is there any way to cat such a call wihtout the big space?
Thanks a lot.
Shengqiao Li