Why isn't the R function sink() writing a summary output to my results file?
There are as many summary functions as there are regression procedures and many of them use cat
with would not get into a value returned. My suggestion is to use cat and capture.output both of which have a file
destination parameter and an append
option:
cat("Here are my results:\n", file="~/R/res4.txt")
capture.output( summary(res4), file"~/R/res4.txt", append=TRUE)
R: Pander sink stack full when printing summary lm
Actually, if you're just running a standard lm
regression, don't pass the summary.lm
object to pander
, pass the model itself (the lm
object)
pander(a.lm)
That should have the information you need. The function calls summary()
internally.
sink() won't print output to text file in rmarkdown
I run into a similar issue. One solution of saving the output to local files is to use write.csv()
function instead, which also works with non-csv files.
The R code below tries to save output to a file called 'example.txt'.
write.csv(data.frame(data_to_save), file='example.txt')
Related Topics
How to Order a Nominale Variable. E.G Month in R
Mass Variable Declaration and Assignment in R
How to Find Correct Executable with Sys.Which on Windows
How to Substitute Symbols in a Language Object
Remove the Columns with the Colsums=0
Http Error 400 on Google_Elevation() Call
Importing Multiple .CSV Files with Variable Column Types into R
Adding an Image to a Datatable in R
Error: Could Not Find Build Tools Necessary to Build Dplyr
Subsetting a Data Frame to the Rows Not Appearing in Another Data Frame
Split on Factor, Sapply, and Lm
How to Manage Parallel Processing with Animated Ggplot2-Plot
Sequentially Rename 100+ Columns Having Idiosyncratic Names
Group Values by Unique Elements
Calculating the Distance Between Points in Different Data Frames