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

这篇博客讲述了如何在R语言中将包含列表的表格导出为CSV或TXT文件。作者遇到了无法导出含有列表元素的表格的问题,通过使用lapply函数结合data.frame转换每个列表元素为数据框,并利用write.table命令逐个追加到文件中,解决了这个问题。
摘要由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、付费专栏及课程。

余额充值