简体   繁体   中英

Delete "" from csv values and change column names when writing to a 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 

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.

I'm also wondering how I can change my column names when writing to CSV files but since i`ma starter I've no clue on how to do this.

See manual write.table {utils} .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM