0

我有一个用户定义的 R 函数来编写我的算法的输出。为了简化一切,它如下所示:

writeMyOutput <- function (fileName="myOutput.txt"){
    fileConn <- file(fileName)
    method <- "BFGS"
    nIter <- "Num of Iter is 70"
    msg <- "Successful convergence"

    writeLines(c(method, nIter, msg), fileConn, sep = "\n")
    close(fileConn)
    estimates <- data.frame(matrix(rep(1:8), nrow =2, ncol=4))
    write.table(estimates, file=fileName, append=TRUE, row.names= F, quote = F) }

当我调用这个函数时,它给了我 write.table() append 命令的以下警告,

enter Warning message:In write.table(estimates, file = fileName, append = TRUE, row.names = F,  :appending column names to filecode here

我想知道如何抑制特定用户定义函数的警告。如果有人可以提供任何帮助,请不胜感激。

4

0 回答 0