[R] Save data in txt

David Winsemius dwinsemius at comcast.net
Sat Sep 12 14:54:25 CEST 2009


On Sep 12, 2009, at 7:56 AM, Lucas Sevilla García wrote:

>
> Hi everyone
>
> I have a little problem with R. I built a lineal regression equation  
> using stepAIC function in both directions. Once I get this formula  
> (lineal regression), I would like to save in a txt file data refered  
> to p-value, r-squared, coefficients,...from the choosen model  
> previously using stepAIC and p-value,r-squared, coefficients,...from  
> each predictor. I try to use function "Write" to create a txt and  
> save that data but I can't.

As I expected I get an error trying ?Write. Are you aware that  
complete case dependence for function names is enforced by R? Or are  
you using a package that has such a function but failed to tell us  
about that fact?


> So, Does anyone know a function to save specific data in a txt?

?cat
?capture.output


> I would like to save that specific data in separated columns, I  
> mean, first column first predictor, second column p-value, third  
> column r-squared, etc...
>
> Refered to data from each predictor (p-value and r-squared), is  
> there an order in R to obtain this data or I have to calculte them  
> by myself?

A specific example would help here. You almost certainly do not need  
to calculate such information. They are probably available in either  
the model object itself or in the results of summary or aov.

> I know I can use r.squared but it gives me a value from the choosen  
> model not from an specific predictor.

If you can be more specific about what you are attempting to derive,  
it would be helpful. I suspect some sort of partial correlation  
coefficient but you are extremely vague in what you need.


>
> Cheers,
>
> Lucas
>
> _________________________________________________________________
> [[elided Hotmail spam]]
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list