用?write.table或者help(write.table)来查看帮助
以下是这个函数的一些参数:
write.table(x, file = "", append = FALSE, quote = TRUE, sep = " ",eol = "\n", na = "NA", dec = ".", row.names = TRUE,
col.names = TRUE, qmethod = c("escape", "double"),
fileEncoding = "")
里面有个append参数,默认是FALSE
appendlogical. Only relevant if file is a character string. If TRUE, the output is appended to the file. If FALSE, any existing file of the name is destroyed.
把这个参数设置成TRUE就可以把数据追加到已有的文件后面了。
数据导出前,先用round函数处理数据精度,再导出。
data.nutrient<-round(data.nutrient,2)
write.table(data.nutrient,file="nutrient04",qmethod="double")