如何删除“”从R中的csv值以及如何在使用R写入CSV时更改列名称 [英] How to delete "" from csv values in R and how to change column Names when writing to a CSV with R
问题描述
我试图从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
围绕我的价值观,是有办法快速做到这一点。
我也想知道如何在写入CSV文件时我可以更改我的列名,但是因为我的启动我不知道如何这样做。
Why is the function putting quotes around my values and is there a way to quickly do this. 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.
提前感谢!
Grts Sander
Grts Sander
推荐答案
a href =http://stat.ethz.ch/R-manual/R-devel/library/utils/html/write.table.html =noreferrer> http://stat.ethz.ch/ R-manual / R-devel / library / utils / html / write.table.html
http://stat.ethz.ch/R-manual/R-devel/library/utils/html/write.table.html
help(write.csv)
write.csv(X,quote=FALSE)
默认情况下引用字段的理由是包含逗号的无引号字段将被错误解释。
The justification for quoting the fields by default is that unquoted fields containing commas will be misinterpreted.
这篇关于如何删除“”从R中的csv值以及如何在使用R写入CSV时更改列名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!