使用 R 中数据框中的列中的文件名创建文本文件

Create text files with name of the files from a column in a data frame in R

我在 R 中有一个数据框,其中包含我想在计算机文件夹中创建的文本文件的名称(MSU870N.wea、MAU870N.tim 等)。我如何在 R 中执行此操作。

像这样?

fn <- c("test1.txt", "test2.txt", "test3.txt")

for(name in fn)
  cat("This is a text file's content", file = name)