0

Can anyone help me on how to format the text file like the format in the image below? I am using R 2.12.2 so the functions of higher version can't be use.

I have tried using writeLine, sprintf and capture.output, but none of it works.. :(

f_output <- file("sample.txt")
writeLines("D8060WK2LA MET1_PAT__ mpy Trend [5300 2450 2050]\n",f_output)
capture.output(summary(lm_out),file="sample.txt",append=T)
capture.output(anova_out,file="sample.txt",append=T)
close(f_output)

enter image description here

1 Answer 1

1

I would suggest trying sink, as in:

sink('sample.txt') # open sink
# run all of your code
sink() # close sink

And you should get what you want.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.