我有如下代码,将数据写入文件
cat("The last signal file and the file before that have",
capture.output(timestamps[1]-timestamps[2]),"\n","\n", file=fileConn)
当我在 Windows 中运行此命令时,我在末尾得到两个空行。 但是当我在 Linux 中运行相同的程序时,我得到的不是两个新行,而是两个空格……我怎样才能得到两个空行?我试过“$\n”,但它没有用。
最佳答案
您可以结合粘贴并使用 sep=\n
:
cat(paste("value1", "value2"),'\n',sep='\n')
关于linux - R Windows/Linux 猫换行符格式之间的差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26069170/