r语言 将表格导出为csv_将列表导出为R中的CSV或TXT文件

这篇博客讲述了如何在R语言中将包含列表的数据结构导出为CSV文件。作者遇到的问题是尝试使用write.table命令时遇到了'list'类型的元素无法导出的错误。解决方案是使用lapply函数配合data.frame,将每个列表转换为数据框并追加写入CSV文件。
摘要由CSDN通过智能技术生成

I'm sorry to ask this question. I'm very noob with R. I know there is a lot of threads which are related to the very same problem. I understood that we cannot export a table if one of its elements is a list but I didn't manage to solve my problem though. So, I got a list in R and I want to export it into a CSV or TXT file. Here is the error message that I get when I execute this write.table command :

write.table(mylist,"test.txt",sep=";")

Error in .External2(C_writetable, x, file, nrow(x), p, rnames, sep, eol, :

unimplemented type 'list' in 'EncodeElement'

Here is the first element of my list :

$f10010_1

$f10010_1$mots

[1] X16 ESPRESSO TDISC TASSIMO

[5] CARTE NOIRE A LAVAZZA

[9] MALONGO MIO MODO 123

[13] CAPSULES DOSES 78G LONG

[17] SPRESSO CAFE 120G CLASSIC

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值