[R] Exporting to text files

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Fri May 18 19:58:39 CEST 2018


Or capture.output

Sent from my iPhone

> On May 18, 2018, at 12:54 PM, Jeff Newmiller <jdnewmil using dcn.davis.ca.us> wrote:
> 
> ?sink
> 
>> On May 18, 2018 9:47:25 AM PDT, Ed Siefker <ebs15242 using gmail.com> wrote:
>> I have dose response data analyzed with the package 'drc'.
>> 'summary(mymodel)' prints my kinetic parameters.  I want
>> that text in an ASCII text file.  I want to get exactly what I
>> would get if I copied and pasted from the terminal window.
>> 
>> I've read the documentation on data export to text files here:
>> https://cran.r-project.org/doc/manuals/r-release/R-data.html#Export-to-text-files
>> 
>> write() does not work.
>> 
>>> summary(mymodel)
>> 
>> Model fitted: Michaelis-Menten (2 parms)
>> 
>> Parameter estimates:
>> 
>>             Estimate Std. Error t-value  p-value
>> d:(Intercept)  213.435     67.094  3.1811 0.009801 **
>> e:(Intercept)   94.493     59.579  1.5860 0.143820
>> ---
>> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>> 
>> Residual standard error:
>> 
>> 22.03492 (10 degrees of freedom)
>>> write(summary(mymodel), "kinetics.txt")
>> Error in cat(x, file = file, sep = c(rep.int(sep, ncolumns - 1), "\n"),
>> :
>> argument 1 (type 'list') cannot be handled by 'cat'
>> 
>> If I try to unlist(mymodel):
>>> write(unlist(summary(mymodel)), "kinetics.txt")
>> I get the following contents of "kinetics.txt":
>> 
>> 485.537711262143
>> 4501.62443636671
>> 3821.31920509004
>> 3821.31920509004
>> 3549.67055527084
>> 213.435401944579
>> 94.4931993582911
>> 67.0941460663053
>> 59.5791117361684
>> 3.18113299681396
>> 1.58601222147673
>> 0.00980057624097692
>> 0.143819823442402
>> MM.2()
>> continuous
>> 10
>> 4.63571040101587
>> 3.93514151059103
>> 3.93514151059103
>> 3.65540149913749
>> Michaelis-Menten
>> 2
>> 22.0349202690217
>> 10
>> 
>> 
>> How do I get the output of 'summary(mymodel)' verbatim? Why doesn't it
>> work the way I think it does? What documentation should I read to
>> understand what's going on here?
>> 
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
> 
> -- 
> Sent from my phone. Please excuse my brevity.
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.




More information about the R-help mailing list