删除“"从CSV值开始,并在写入CSV时更改列名称 [英] Delete "" from csv values and change column names when writing to a CSV
问题描述
我正在尝试从R表创建csv文件.但是我不明白为什么所有的价值观都会得到 当我使用write.csv()函数时,用"检查.我的数据如下:
I'm trying to create csv files out of an R table. But i cant understand why all the values get checked with "" when i use the write.csv() function. my data looks like this:
Sample Sample_Name Sample_Group Pool_ID Sample_Plate NorTum Sentrix_ID Sentrix_Position HybNR
1 00_11242 00_24200N2 MUTYH GS0005703-OPA GS0010004-DNA N 1280307 R007_C005 1
2 00_11242 00_24200N2 MUTYH GS0005704-OPA GS0010004-DNA N 1280307 R007_C011 1
3 00_11242 00_24200N2 MUTYH GS0005702-OPA GS0010004-DNA N 1416198 R007_C011 2
4 00_11242 00_24200N2 MUTYH GS0005701-OPA GS0010004-DNA N 1416198 R007_C005 2
5 00_7 00_7T MUTYH GS0005701-OPA GS0010004-DNA T 1416198 R006_C005 2
6 00_7 00_7T MUTYH GS0005702-OPA GS0010004-DNA T 1416198 R006_C011 2
7 00_7 00_7T MUTYH GS0005704-OPA GS0010004-DNA T 1280307 R006_C011 1
8 00_7 00_7T MUTYH GS0005703-OPA GS0010004-DNA T 1280307 R006_C005 1
9 01_677 01_677N HNPCC_UV GS0005701-OPA GS0010004-DNA N 1416198 R002_C006 2
10 01_677 01_677N HNPCC_UV GS0005704-OPA GS0010004-DNA N 1280307
在CSV格式的输出文件中,每个值如下所示:
And in the output file which is a CSV every value looks like this:
"100" "R05_80611" "R05_80611N" "NA_FAM" "GS0005701-OPA" "GS0010004-DNA" "N" 1416198 "R003_C006" 2
该函数为什么要在我的值两边加上引号,并且有一种快速执行此操作的方法.
Why is the function putting quotes around my values and is there a way to quickly do this.
我还想知道在写入CSV文件时如何更改列名,但是由于我是一个入门者,所以我不知道如何执行此操作.
I'm also wondering how I can change my column names when writing to CSV files but since i`m a starter I've no clue on how to do this.
推荐答案
请参见手册默认情况下引用字段的理由是包含逗号的未引用字段将被误解.
The justification for quoting the fields by default is that unquoted fields containing commas will be misinterpreted.
这篇关于删除“"从CSV值开始,并在写入CSV时更改列名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!