[R] Multiple outputs of a function

isabelle Zabalza-Mezghani isabelle.zabalza-mezghani at ifp.fr
Thu Oct 19 09:45:05 CEST 2000


Hello everybody,

I'm writting some functions for experimental designs. The one I'm
working on is similar to "fac.design" on Splus.
The problem I have is with the form of the output :

When the argument fraction is submitted, Splus gives something like :

     A  B  C
 1   -  -  -
 2   +  +  -
 3   +  -  +
 4   -  +  +

Fraction :  ~A:B:C

The first part of this output is the design, and the second part is the
formula which allows to fractionate the full design. This output isn't a
list.
My problem is the following :
I can't manage to obtain such a composite output. The lonely way I've
already found is to use :
print(design)
cat("Fraction:  ")
print(attr(design,"fraction")).

This solution is only suitable for an output on screen, but it reveals
bad as soon as I assign this function
to an object (for ex: tmp <- fac.design( ....) ) since only the last
command I performed (here print(attr(design,"fraction")))
is assigned to my object tmp.

I hope someone can help me ...

Regards,

Isabelle Zabalza-Mezghani


--
Isabelle Zabalza-Mezghani          Tel : 01 47 52 61 99
Institut Français du Pétrole       E-mail : isabelle.zabalza-mezghani at ifp.fr
1-4 Av. Bois Preau - Bat Lauriers
92852 Rueil Malmaison Cedex, France


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20001019/4b7217a1/attachment.html


More information about the R-help mailing list