同时输出并在R中显示结果
Simultaneously Output and show the result in R
我想知道是否可以在 控制台 (Rstudio) "AND ALSO"[ 中同时显示 cat(...)
=21=] 以.txt
格式保存文件?
这是我的 R 代码:
SOS = 33
df = 12
cat("\n","-------------", "\n" ,"SOS "," df","\n", "-------------","\n",
SOS," ",df,"\n", "-------------", file = "Output.txt" )
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")
我想知道是否可以在 控制台 (Rstudio) "AND ALSO"[ 中同时显示 cat(...)
=21=] 以.txt
格式保存文件?
这是我的 R 代码:
SOS = 33
df = 12
cat("\n","-------------", "\n" ,"SOS "," df","\n", "-------------","\n",
SOS," ",df,"\n", "-------------", file = "Output.txt" )
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")