Reputation: 7517
I'm wondering if it would be possible to both show a cat(...)
in the console (Rstudio) "AND ALSO" save the file in .txt
format?
Here is my R code:
SOS = 33
df = 12
cat("\n","-------------", "\n" ,"SOS "," df","\n", "-------------","\n",
SOS," ",df,"\n", "-------------", file = "Output.txt" )
Upvotes: 1
Views: 73
Reputation: 32558
SOS = 33
df = 12
#prepare your output
x = paste("\n","-------------", "\n" ,"SOS "," df","\n", "-------------","\n",
SOS," ",df,"\n", "-------------", sep = "")
#display in console
cat(x)
#-------------
#SOS df
#-------------
#33 12
#-------------
#Write to a txt file
cat(x, file = "output.txt")
Upvotes: 1