在R语言中,可以使用`write.table()`函数将数据存储到已有的表中。首先,需要先读取已有表的数据到R中,可以使用`read.table()`函数。
然后,对原有表进行修改后,可以使用`write.table()`函数将修改后的数据覆盖原有表。
在`write.table()`函数中,需要指定要写入的文件路径和名称,以及数据的分隔符和其他参数,例如`sep`参数用于指定数据的分隔符,`col.names`参数用于指定是否包含列名等。通过这样的方式,就可以将数据存储到已有表中。
把数据写入excel,主要是用write.table函数
用?write.table或者help(write.table)来查看帮助
以下是这个函数的一些参数:
write.table(x, file = "", append = FALSE, quote = TRUE, sep = " ",
eol = " ", na = "NA", dec = ".", row.names = TRUE,
col.names = TRUE, qmethod = c("escape", "double"),
fileEncoding = "")
里面有个append参数,默认是FALSE
append
logical. 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就可以把数据追加到已有的文件后面了。