当前位置:网站首页>A simple and crude method for exporting R language list to local
A simple and crude method for exporting R language list to local
2022-06-26 22:44:00 【Analysis of breeding data】
occasionally , My result is a list, Can't be converted into data.frame Data frame , Force output with data frame function , The results changed , such as :
- fwrite
- write.table
- write.csv
- write.xlsx
None of this . Chinese search did not find the right answer , Later on stackoverflow eureka , You still need to search the answers in English .
https://stackoverflow.com/questions/27594541/export-a-list-into-a-csv-or-txt-file-in-r
therefore , I learned , The principle to be written , Just write a summary , It's convenient for later generations .
1. My irregular data
> va_list
$y1
component std.error z.ratio bound %ch
vm(ID, ainv) 0.04524 0.01369 3.305 P 0.1
units!units 0.09159 0.01134 8.076 P 0.1
units!R 1.00000 NA NA F 0.0
$y2
component std.error z.ratio bound %ch
vm(ID, ainv) 0.5822 0.3047 1.910 P 0.8
units!units 2.9777 0.3071 9.697 P 0.1
units!R 1.0000 NA NA F 0.0
$y3
component std.error z.ratio bound %ch
vm(ID, ainv) 0.3415 0.09944 3.434 P 0
units!units 0.7387 0.08486 8.705 P 0
units!R 1.0000 NA NA F 0
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
I want to put this result , Save to txt In file , Don't change the format .
If I force it out to txt Documents or , It turns out like this :

Or it's like this :

The format is all out of order .
here , I found two ways , It can be done . give the result as follows :

2. Method 1:sink function
sink Function first opens an empty file , Then input the contents of the following screen , Then close the file .
# Create a new file :va_result.txt
sink("va_result.txt")
# Write content
va_list
# Close file
sink()
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
You can see , No change in format .
$y1
component std.error z.ratio bound %ch
vm(ID, ainv) 0.04524 0.01369 3.305 P 0.1
units!units 0.09159 0.01134 8.076 P 0.1
units!R 1.00000 NA NA F 0.0
$y2
component std.error z.ratio bound %ch
vm(ID, ainv) 0.5822 0.3047 1.910 P 0.8
units!units 2.9777 0.3071 9.697 P 0.1
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
3. Method 2:capture.output function
Be careful ,file = An integral .
capture.output(va_list, file = "va1_result.txt")
- 1.
Results check :

The second method is simpler , Recommended .
Welcome to my official account. :
Analysis of breeding data . Mainly share R Language ,Python, Breeding data analysis , Biostatistics , Quantitative genetics , Mixed linear model ,GWAS and GS Relevant knowledge .
边栏推荐
- 【数学建模】基于matlab GUI随机节点的生成树【含Matlab源码 1919期】
- Unity: the referenced script (unknown) on this behavior is missing“
- 从位图到布隆过滤器,C#实现
- WP collection plug-in tutorial no thanks for WordPress collection of rules
- 6.24 学习内容
- 美术向的Unity动画知识
- Product design in the extreme Internet Era
- Leetcode - the best time to buy or sell stocks
- 开放世界机甲游戏-Phantom Galaxies
- [Old Wei makes machines] issue 090: keyboard? host? Full function keyboard host!
猜你喜欢

CVPR 2022 - Interpretation of selected papers of meituan technical team

leetcode:710. 黑名单中的随机数【映射思维】

YOLOv6:又快又准的目标检测框架开源啦

Briefly describe the model animation function of unity
![leetcode:1567. 乘积为正数的最长子数组长度【dp[i]表示以i结尾的最大长度】](/img/a4/c5c31de7a0a3b34a188bfec0b5d184.png)
leetcode:1567. 乘积为正数的最长子数组长度【dp[i]表示以i结尾的最大长度】

Flashtext, a data cleaning tool, has directly increased the efficiency by dozens of times

在线协作文档综合评测 :Notion、FlowUs、Wolai、飞书、语雀、微软 Office、谷歌文档、金山文档、腾讯文档、石墨文档、Dropbox Paper、坚果云文档、百度网盘在线文档

VB. Net class library to obtain the color under the mouse in the screen (Advanced - 3)

Restfultoolkitx of idea utility plug-in -- restful interface debugging

The sharp sword of API management -- eolink
随机推荐
360手机助手首家接入APP签名服务系统 助力隐私安全分发
Centos7 compiling and installing redis
买股票通过中金证券经理的开户二维码开户资金是否安全?想开户炒股
DLA model (classification model + improved segmentation model) + deformable convolution
Centos7编译安装Redis
从位图到布隆过滤器,C#实现
[bug feedback] the problem of message sending time of webim online chat system
Is it safe for CICC fortune to open an account? I want to open an account to speculate in stocks.
美术向的Unity动画知识
Is there any risk for flush to register and open an account? Is it safe?
在线协作文档综合评测 :Notion、FlowUs、Wolai、飞书、语雀、微软 Office、谷歌文档、金山文档、腾讯文档、石墨文档、Dropbox Paper、坚果云文档、百度网盘在线文档
简述unity的模型动画功能
Système de distribution Unity Composants en tissu (y compris les dépendances d'appel dynamique)
Flower shop window layout [dynamic planning]
leetcode:152. Product maximum subarray [consider DP of two dimensions]
这个算BUG吗?乱填的字母是否可以关闭
leetcode:1567. Length of the longest subarray whose product is a positive number [dp[i] indicates the maximum length ending with I]
Convolutional neural network (CNN) explanation and tensorflow2 code implementation
Comprehensive evaluation of online collaboration documents: note, flowus, WOLAI, Feishu, YuQue, Microsoft office, Google Docs, Jinshan docs, Tencent docs, graphite docs, Dropbox paper, nutcloud docs,
Vulnhub's dc9