我正在尝试对一组数字使用聚合函数。在聚合完成计算我想要的函数后,我将输出写入 csv 文件。但是这个 CSV 文件由一个值表和一个计数表组成。我想删除计数表。我检查了聚合的小插图和整个 {STATS} 手册。但是找不到可以为我执行此操作的参数。
所以问题是:如何告诉聚合我只想要值列而不是计数列?
我写的聚合函数:
sdint<-aggregate(assayData(object)$intensity[,sample],
by = list(assayData(object)$states[,sample]),
sd,
na.rm=TRUE)
我正在使用的数据: 数据
我想要的输出:
0.576778569
0.300184855
0.303007167
0.339285757
0.309673603
0.345517885
0.218438482
0.274175334
0.322680676
0.342179188
0.321930905
0.391558862
0.365504912
0.37906546
0.425801585
0.348280535
0.330063333
0.388093547
0.262649566
0.202235805
0.294549104
0.206346439
0.190531238
0.227790818
0.238224514
0.264646831
0.286682489
0.231069902
0.25936052
0.363558042
0.210798912
0.18124299
0.438063879
0.264264297
0.254382012
0.464863254
我得到的输出:
1 0.576778569
2 0.300184855
3 0.303007167
4 0.339285757
5 0.309673603
6 0.345517885
7 0.218438482
8 0.274175334
9 0.322680676
10 0.342179188
11 0.321930905
12 0.391558862
13 0.365504912
14 0.37906546
15 0.425801585
16 0.348280535
17 0.330063333
18 0.388093547
19 0.262649566
20 0.202235805
21 0.294549104
22 0.206346439
23 0.190531238
24 0.227790818
25 0.238224514
26 0.264646831
27 0.286682489
28 0.231069902
29 0.25936052
30 0.363558042
31 0.210798912
32 0.18124299
33 0.438063879
34 0.264264297
35 0.254382012
36 0.464863254
左边的数字不应该显示!
CSV格式的最终数据:
SNP_NAME,x0,x1,y,pos.start,pos.end,chrom,count,copynumber,intensity,allele.B,Lair,uncertain,Count,StandardLairDev,Count,MAX Lair,StandardIntDev,sample_id
"rs2065525",0,0,0,1896162,3138455,1,11,2,0.855,0,0.425,FALSE,1,0.287467339786124,1,0.999191681792884,1,0.576778568588604,"00_11242T1"
"rs1694379",0,0,0,3138456,148286049,1,263,2,0.9825,0,0.4758,FALSE,2,0.25066539967999,2,0.999763634558257,2,0.300184854995405,"00_11242T1"
"rs2027432",0,0,0,148286050,122268329,1,204,2,1.1092,1,0.8893,FALSE,3,0.128285157028804,3,0.999780287813653,3,0.303007166704586,"00_11242T1"
"rs16747",0,0,0,122268330,121622963,2,475,2,1.0407,0,0.7684,FALSE,4,0.16048988360498,4,0.99988056078919,4,0.339285756513036,"00_11242T1"
"rs1490265",0,0,0,121622964,67491556,3,136,2,1.0775,1,0.8031,FALSE,5,0.139532962911464,5,0.998567181034836,5,0.309673602648317,"00_11242T1"
"rs1864668",0,0,0,67491557,99834810,3,262,2,1.0775,0,0.6657,FALSE,6,0.174074950555206,6,0.999664655449619,6,0.345517884636054,"00_11242T1"
"rs1363207",0,0,0,99834811,182678081,4,270,2,0.883,0,0.5592,FALSE,7,0.22676775183123,7,0.999303463143844,7,0.218438481623468,"00_11242T1"
"rs1915853",0,0,0,182678082,96069863,4,26,2,0.6829,0,0.7207,FALSE,8,0.147755391322562,8,0.999377450758501,8,0.274175334131741,"00_11242T1"
"rs40207",0,0,0,96069864,57625291,5,98,2,1.0482,0,0.6674,FALSE,9,0.193783525020888,9,0.99961281189186,9,0.322680675891498,"00_11242T1"
"rs2041318",0,0,0,57625292,126652199,5,121,2,0.891,1,0.8323,FALSE,10,0.126062170080585,10,0.9997133021412,10,0.34217918778308,"00_11242T1"
"rs1053110",0,0,0,126652200,90354277,5,93,2,1.0506,0,0.7829,FALSE,11,0.156375642874615,11,0.998198995215151,11,0.32193090491761,"00_11242T1"
"rs2021899",0,0,0,90354278,85692795,6,410,2,1.0628,1,0.8398,FALSE,12,0.15435382388065,12,0.99993200438923,12,0.391558862043803,"00_11242T1"
"rs455030",0,0,0,85692796,79407284,7,285,2,1.0871,1,0.8669,FALSE,13,0.132137812936442,13,0.999929485697204,13,0.365504911746432,"00_11242T1"
"rs1433396",0,0,0,79407285,122076407,8,212,2,0.9334,0,0.4804,FALSE,14,0.263530051339396,14,0.999654307577374,14,0.379065459942171,"00_11242T1"
"rs755520",0,0,0,122076408,129448086,8,15,2,1.4429,0,0.4941,FALSE,15,0.149143991344688,15,0.914078743250954,15,0.425801584614172,"00_11242T1"
"rs1735173",0,0,0,129448087,73161466,8,33,2,0.9364,0,0.4316,FALSE,16,0.278273609876866,16,0.996653200437299,16,0.348280535013844,"00_11242T1"
"rs2026349",0,0,0,73161467,66782116,9,71,2,1.1968,1,0.8239,FALSE,17,0.189895617817744,17,0.999776858536029,17,0.330063332737979,"00_11242T1"
"rs735107",0,0,0,66782117,130050087,9,117,2,0.9506,1,0.8461,FALSE,18,0.141861258733706,18,0.999894912286988,18,0.388093547266615,"00_11242T1"
"rs766374",0,0,0,130050088,68176968,9,17,2,1.0932,1,0.8713,FALSE,19,0.0910714792585353,19,0.997719201852223,19,0.262649566352474,"00_11242T1"
"rs880340",0,0,0,68176969,67402459,10,248,2,1.068,0,0.4195,FALSE,20,0.269922761074577,20,0.999527729786447,20,0.202235805019638,"00_11242T1"
"rs4430531",0,0,0,67402460,67321605,11,229,2,1.1385,1,0.8932,FALSE,21,0.123084967048419,21,0.999592791631743,21,0.294549103735107,"00_11242T1"
"rs7960480",0,0,0,67321606,74655759,12,285,2,1.0545,1,0.8229,FALSE,22,0.122983123511285,22,0.999569526493407,22,0.206346438819543,"00_11242T1"
"rs14067",0,0,0,74655760,65198000,13,187,2,1.1479,1,0.8936,FALSE,23,0.118977461806947,23,0.999132908666796,23,0.190531237977798,"00_11242T1"
"rs1989749",0,0,0,65198001,62810767,14,210,2,0.9512,0,0.5011,FALSE,24,0.243205200245574,24,0.999570632007492,24,0.22779081826097,"00_11242T1"
"rs1192113",0,0,0,62810768,49992524,15,201,2,0.9459,0,0.5006,FALSE,25,0.242235554332421,25,0.999923600003544,25,0.238224514088702,"00_11242T1"
"rs869048",0,0,0,49992525,44973166,16,197,2,1.14,1,0.8493,FALSE,26,0.113266709360598,26,0.999410137369512,26,0.26464683057347,"00_11242T1"
"rs3785513",0,0,0,44973167,40857471,17,159,2,1.0119,0,0.4846,FALSE,27,0.247823361318723,27,0.999773260918777,27,0.286682489405067,"00_11242T1"
"rs420905",0,0,0,40857472,9614641,18,22,2,0.8881,0,0.7783,FALSE,28,0.143466524230892,28,0.989549332985043,28,0.231069902005914,"00_11242T1"
"rs1805272",0,0,0,9614642,38052783,18,148,2,0.8881,0,0.5326,FALSE,29,0.223315888643138,29,0.998876808487203,29,0.259360520111394,"00_11242T1"
"rs3499",0,0,0,38052784,31952708,19,149,2,1.0146,0,0.4964,FALSE,30,0.234643478722549,30,0.999581141159297,30,0.363558042382673,"00_11242T1"
"rs912239",0,0,0,31952709,39291277,20,130,2,1.1629,1,0.891,FALSE,31,0.141976210855505,31,0.999162417982582,31,0.210798912384771,"00_11242T1"
"rs2839377",0,0,0,39291278,31199103,21,103,2,0.9569,0,0.5286,FALSE,32,0.234526243870833,32,0.999309316327552,32,0.181242989596378,"00_11242T1"
"rs10451",0,0,0,31199104,26461186,22,121,2,0.9089,0,0.4561,FALSE,33,0.261911141225885,33,0.999345284476758,33,0.438063878776732,"00_11242T1"
"rs6780",0,0,0,26461187,70501188,98,125,2,1.1575,1,0.9065,FALSE,34,0.132476526665054,34,0.999987049231316,34,0.264264297319435,"00_11242T1"
"rs2032438",0,0,0,70501189,76057512,98,179,2,1.0443,1,0.8159,FALSE,35,0.128901714920779,35,0.999765208281892,35,0.254382011767866,"00_11242T1"
"rs31185",0,0,0,76057513,23098508,99,18,2,0.9412,-4,NA,FALSE,36,0.228356984022432,36,0.993785747186676,36,0.464863253679381,"00_11242T1"