将列表写入txt文件

c

我想将段落列表写入txt文件中,以在对其进行操作后查看,该列表被调用psw_list,您可以使用引用第一段psw_list$p1psw_list$p1好像:

> psw_list$p1
[1] "For more than five years, William Sencion did the same task over and over. He signed onto the New York City’s housing lottery site and applied for one of the city’s highly coveted, below-market apartments. Each time, he got the same response: silence."

有任何想法吗?

应变

您正在寻找write(...)函数。如果要将所有段落写入一个文件,则需要使用unlist(...)函数,如下所示。

这些函数会将生成的.txt文件转储到您的工作目录中。

psw_list <- c()
psw_list$p1 <- "For more than five years, William Sencion did the same task over and over. He signed onto the New York City’s housing lottery site and applied for one of the city’s highly coveted, below-market apartments. Each time, he got the same response: silence."
psw_list$p2 <- "Something something dark side. Luke I am your father."

write(psw_list$p1, "first_paragraph.txt")
write(unlist(psw_list), "all_pragraphs.txt")

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

将列表写入txt文件时被缩短

来自分类Dev

将列表写入txt文件时被缩短

来自分类Dev

将“ <”或“>”写入.txt文件

来自分类Dev

无法将列表的结果写入json或txt文件

来自分类Dev

如何正确将元组列表写入.txt文件?

来自分类Dev

将列表写入文件txt(utf-8)

来自分类Dev

将字符串列表写入txt文件,但文件为何为空?

来自分类Dev

python将列表写入文件

来自分类Dev

将文件写入元组列表

来自分类Dev

将列表理解写入文件

来自分类Dev

将值列表写入文件

来自分类Dev

将双打列表写入文件

来自分类Dev

在python中将列表写入txt文件

来自分类Dev

每行将多个列表写入txt文件

来自分类Dev

如何将字符串数组列表写入txt文件

来自分类Dev

使用python将列表写入.txt文件时,出现'\n'(反斜杠n)?

来自分类Dev

将列表写入 .txt 文件,用逗号分隔所有内容

来自分类Dev

无法将csv写入.txt文件?的PHP

来自分类Dev

将行写入.txt文件C ++

来自分类Dev

将网络数据写入TXT文件

来自分类Dev

将大双数写入txt文件C ++

来自分类Dev

将鼠标位置写入.txt文件

来自分类Dev

硒将值写入.txt文件

来自分类Dev

将python函数输出写入.txt文件

来自分类Dev

将大数据框写入txt文件

来自分类Dev

无法将csv写入.txt文件?的PHP

来自分类Dev

将行写入.txt文件C ++

来自分类Dev

将浮动列表写入CSV文件

来自分类Dev

将列表的字典写入CSV文件