[R] make stat.desc output an object

Bert Gunter gunter.berton at gene.com
Wed May 29 15:57:23 CEST 2013


Inline:

On Tue, May 28, 2013 at 9:22 PM, Berend Hasselman <bhh at xs4all.nl> wrote:
>
> On 28-05-2013, at 19:31, bcrombie <bcrombie at utk.edu> wrote:
>
>> How do I assign a variable to R output that is generated by default functions such as:
>> stat.desc(mydata, basic=TRUE, desc=TRUE, norm=FALSE, p=0.90)
>> summary(mydata)
>> Another way to put it:  how can I turn an R function result into an object?
>>
>
> ?capture.output

Unless I misunderstand, I don't think so. This just captures printed
output as a character vector. To capture the "result" of a call as an
object, just assign it:

result <- summary(mydata).

However, and again if I have not misunderstood, I believe the query
indicates the OP has not done his/her homework by reading a basic R
tutorial, like An Introduction to R and does not understand that most
R functions already return summary objects that are automatically
printed by the relevant print method.

-- Bert

>
> Berend
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list