0

やろうとすると1日以上です。私が知っているすべての方法を試してみましたが、行き詰まって何もできない場合があります。私はとても必死です。表示すべきものをすべて表示するために、長いスレッドを書きました。何か提案があれば、コメントしてください。前回です。約束します。

それは私のデータです:

> tbl_reo

    id          Sequence         variable         value
    75   AAAAGAAAVANQGKK    BiotinControl1_2    3893050.50 
   192   AAAAGAAAVANQGKK    BiotinControl1_2    900604.61 
  3770   AAFTKLDQVWGSE      BiotinControl1_2    90008.14
   934   AAIKFIKFINPKINDGE  BiotinControl1_2    656399.2021
  1012   AAIKFIKFINPKINDGE  BiotinControl1_2    359937.85
  1970   AAIKFIKFINPKINDGE  BiotinControl1_2    447089.3547
    75   AAAAGAAAVANQGKK    BiotinControl2      2717893.323
   192   AAAAGAAAVANQGKK    BiotinControl2      741299.3331
  3770   AAFTKLDQVWGSE      BiotinControl2      87127.07152
   934   AAIKFIKFINPKINDGE  BiotinControl2      646758.138
    75   AAAAGAAAVANQGKK    BiotinTreatment1_2  3435216.403
   192   AAAAGAAAVANQGKK    BiotinTreatment1_2  818936.8906
  3770   AAFTKLDQVWGSE      BiotinTreatment1_2  85120.95436
   934   AAIKFIKFINPKINDGE  BiotinTreatment1_2  1068384.547

p値を計算するために使用しようとしているコード:

私のコード:

tbl_anv <- tbl_all_onlyK[,c("id", "BiotinControl1_2", "BiotinControl2", "BiotinControl3", "BiotinTreatment1_2", "BiotinTreatment2", "BiotinTreatment3", "Sequence")]

tbl_reo <- melt(tbl_anv, measure.vars=2:7)

set.seed(1)
vars <- c("id", "BiotinControl1_2", "BiotinControl2", "BiotinControl3",   
      "BiotinTreatment1_2", "BiotinTreatment2", "BiotinTreatment3",
      "Sequence")

tbl_reo <- as.data.frame(tbl_reo)

by(tbl_reo,tbl_reo$Sequence,function(x){ 
  anova(lm(value ~ variable, data = x))$"Pr(>F)"[1]
  })

エラーが発生します:

There were 50 or more warnings (use warnings() to see the first 50)

とにかく、どうすればそれを行い、別の列に p 値をエクスポートできますか。

それが私が自分でやろうとしたことです:

aov_test <- by(tbl_reo,tbl_reo$Sequence,function(x){ 
anova(lm(value ~ variable, data = x))$"Pr(>F)"[1]
})
tbl_reo[,5]  <- aov.test[[1]]$'Pr(>F)'[1]

編集:だから私はあなたの提案に従い、私の問題を示すために最善を尽くしました. それでは、 head() から始めましょう。

> dput(head(tbl_reo))
structure(list(id = c(75L, 192L, 3770L, 934L, 1012L, 1970L), 
Sequence = structure(c(1L, 1L, 3L, 5L, 5L, 5L), .Label = c("AAAAGAAAVANQGKK", 
"AAANILFSDHAD", "AAFTKLDQVWGSE", "AAIELRE", "AAIKFIKFINPKINDGE", 
"AAIYKLLKSHFRNE", "AAKKFEE", "AAKYFRE", "AANVKKTLVE", "AARAGELLKE", 
"AARDSKSPIILQTSNGGAAYFAGKGISNE", "AAVKARVASIDE", "AAVKASAPGSVILLE", 
"AEKLKAE", "AEQVKKE", "AFAKRQGKE", "AFGSGTAAVVSPIKE", "AGIPAGVVNILPGSGRVVGE", 
"AGISKDGQTRE", "AGSHGKDAWGVFRVHAFE", "AHSFSSSLASAE", "AIDALNGMLLNGQE", 
"AITYSWTLLTE", "AKAKKAAKKAANAKQQQE", "AKALVAQGVKFIAE", "AKAQGVAVQLKRQPAQPRE", 
"AKIGKKVE", "AKKVVKKAFEE", "AKNKKYALDIIKE", "ALANAGVTDIVLAVNYRPE", 
"ALDFFARGLVKSPIKVVGLSTLPE", "ALFHPSVLGLE", "ALKIWKRFRE", 
"ALKPDSQKSYAE", "ALLLKVNQIGTLSE", "ALRIGSE", "ALRLVE", "AMRIGSE", 
"ANIIKLVE", "ANNKWNKLFSE", "ANVTGLRDAMFKGE", "AQKVRDQITSLKE", 
"AQRVQAKNQLE", "ARINFGIEKAKE", "ASAGIQLSPKFVKLVSWYDNE", "ASFVLPTWAAKE", 
"ASKLAAYNKKSTISARE", "ATSSIVMFSLNE", "ATTNAPWYKGWEKE", "ATVGAGLPIISFLRE", 
"AVDATHLAE", "AVIRLSKE", "AVSKVYARSVYDSRGNPTVE", "AVVTVPAYFNDSQRQATKD", 
"AVWYGPPKAANLGGVAVSGLE", "AWFPYQKE", "AYSPFGSANAPLLKE", "DGWVPGKNLFTVE", 
"DHSFINYKQNVE", "DILYKIYKGVSE", "DLYQTFARTVE", "DNVKAHPRIE", 
"DQVRNYVMQYIQE", "DSVYLAKLAE", "DVHNLFTYAKE", "DVKISAGTLLKGTE", 
"DVQKFRHE", "EAVAKAAE", "EKPLFLVFHGGSGSTVQE", "EQRPGTPLFTVKAYLPVNE", 
"ERIAALE", "FAKSLPRLDGLSVQE", "FALKHFPDYE", "FAPYGTITSAKVMRTE", 
"FASLFPLKQAPAFLGPKGLKLTE", "FEQKNAGGVGE", "FFIDRPE", "FFIRDTKNLE", 
"FGINTTVQE", "FGNRPMILHQIE", "FGVTKARWPAKSVKFVQGLLQNAAANAE", 
"FIFSKYQILE", "FKMAKPE", "FKSMIKNNE", "FKTKYNSDPYQLE", "FLAADKE", 
"FLKKILVDNKLE", "FLLSYGKE", "FMIAPTGAKTFAE", "FMISQLGLQKKNIKIHGF", 
"FNRGLALE", "FNSQPDYRE", "FQKDAKRFE", "FQKTGPFE", "FRNGMINVSPIGRNASTEE", 
"FRTASAQLE", "FSGSLLRSKFNTSNE", "FSRWFNHIASKADE", "FSTNVKDE", 
"FTADGKVKPE", "FTPETPSPLIGILE", "FVADGLLQGFGNE", "FVAYPIQLLVTKE", 
"FVAYPIQLVVTKE", "FVDIINSRN", "FVSSKHGSVSAE", "FYKSLKLPYRIVGIVSGE", 
"GAAPGGFPGGAPPAPE", "GAIWNINSFDQWGVE", "GARYGPSLMPGGSEE", 
"GEKTMGAKITKSLE", "GGLGPINIPLLADTNHSLSRD", "GGTLIGTARSME", 
"GGVAPNIQTAEE", "GGVIIITHSAE", "GIFSGTLSYIFNE", "GIKVPIHIVQE", 
"GILQRWTKGFDIPNIE", "GILQRWTKGFDIPNVE", "GILVASPFVELE", "GIPAGWQGLDNGPE", 
"GIPPDQQRLIFAGKQLE", "GISKKTRIAGVVYHPSNNE", "GKKIATYQE", 
"GKLKGVLGYTE", "GLDKIFQE", "GLGWGNNASAAIQRVGLGE", "GLNHLPVQKQIVE", 
"GMMANGIAAGGQLTTTTE", "GMRWAGNANE", "GNDIHALAAKLLQE", "GQALKKKKGKSAE", 
"GRGINSSYAVWNDVTGKAHE", "GRHSGYGKRKGTRE", "GSDVLNTWKKE", 
"GSRKVDGQKVKASKE", "GTAVSQADVTVFKAFQSAYPE", "GTERSAYYTWAAE", 
"GTRAVTKYSSSTQA", "GVVLGVEKRATSPLLE", "GWGTPHIKPYGNLSLDPSACVFHYAFE", 
"GYSGVEVRVTPTKTE", "GYVGRTQPKKGGEGE", "GYWNGKITVDE", "HDHAGVPLKISPPVVAYRE", 
"HIIQAKADAQRE", "HIVPGTYIQE", "HKFAIPAINVTSSSTAVAALE", "HKVVNGNSADAAYAQVE", 
"HLQPHFTTNDGLE", "HNLRVISE", "HQIRAKFVE", "HQKYTREQVGCKE", 
"IAKLNIPTGIPLVFE", "IAQHIFTKLNSNGYLEE", "IDASKPVKLTLLISE", 
"IDPINALQAAME", "IDVAWLKANAKE", "IEAISSPLMGIFE", "IFDANVQRLKE", 
"IFFKIKKTTPLRRLME", "IFGGYLYFAQAPSAAE", "IFGGYLYFAQAPSAAEFHTE", 
"IFGPVVTVAKFKTLEE", "IFGPVVTVTKFKSADE", "IFLHSLPVKE", "IFSTYADNQPGVLIQVFE", 
"IGATTSVFPFNKSMIEYLE", "IGNSGMFRPEMLE", "IGSLTRQGAKGGLLE", 
"IHPLLPQDE", "IIAGNVATRE", "IIGGTTRIPTLKQSISE", "IIKKNFDLRPGVLVKE", 
"IISNAKGQVVGSIIALDRQE", "IKGFFSFATQKLDE", "IKHLPFNVVNKDGKPAVE", 
"IKKVVKAAAE", "IKLFNKWSFEE", "IKLVKLIQE", "ILIVTKDGVRKE", 
"ILKIVPGRVSTE", "ILKKLDE", "ILLARNLI", "ILNKLALRILKNE", "ILNSQAPEE", 
"ILSKLASAGATE", "ILWRQKE", "IMLPVFDAPQNLVE", "IMLQLGIPREE", 
"IMLWNLAAKKAMYTLSAQDE", "INLPFITADASGPKHINMKFSRAQFE", "INLWFKKEE", 
"IQLNGGSISE", "IQPRANIQLDFPE", "IRVFQGE", "ISAMVLTKMKE", 
"ISDTMWPGQAMTLKVE", "ISDVFAKWNNGVLD", "ISLAAFGRKE", "ISTMIRWGLKPYLFVLNNDGYTIE", 
"ITDIKQFLE", "ITHPTIVDGWFRE", "ITLGKYLFE", "ITQLMSLIINTVYSNKE", 
"ITVDAPKAHE", "ITYLNNRAAAEYE", "IVERLNTASIPE", "IVFASPPRKSDGKVSPE", 
"IVFNMSREE", "IVNLTLPDGTVRQGQVLE", "IVPKLME", "IVRVNKNAPAVE", 
"IVSRFKTE", "IYEKME", "IYFSLNNGVRIPALGLGTANPHEKLAE", "IYNHIQLRE", 
"IYNHIQLREE", "IYPYGSRGPKGLKE", "KAAKVTKAAQKAAKK", "KAALQTYLPKIKE", 
"KAEQVFQNVKNILAE", "KAITYSHAAKE", "KAKIGQKE", "KAKKANNPQHSITKDE", 
"KALTYTPPKKQKAEKPKAE", "KAQRAPLEE", "KAVAYWKTLKTDE", "KDFATFAKE", 
"KDYASVVPPRHNE", "KEKLTQQKKE", "KFAAGTKALLDE", "KFINSEIE", 
"KFNAVPIFLSDE", "KFSERLLNE", "KGAQTYVKKVIGSFKDWE", "KGCDIIVKNHE", 
"KGLLSATQFTQPALTLME", "KGLSKKGGNIPMIPGWVMDFPTGKE", "KGQIVGRYVVDTSK", 
"KGTGKSNKITITNDKGRLSKE", "KGVFRSIVPSGASTGVHE", "KGVFRSIVPSGASTGVHEALE", 
"KGVITTQAE", "KGWVPVTKLGRLVKAGKITTIEE", "KIFTVPTETLQAVTKHFISE", 
"KIGDLNFLIGPKLYE", "KKAADALLLKVNQIGTLSE", "KKAGKTLDVVE", 
"KKAPAAAPAASKKKEE", "KKIDLASIRE", "KKPKTKKVKEE", "KKQAIRSKQE", 
"KKTISLKTPLKTLVILHSDE", "KKVYPDVLYTSKLSRAIQTANIALE", "KKYIATIGVE", 
"KLAAQRKAE", "KLIHGPKAQYNE", "KLIHNDSSYNHE", "KLKAAYSYMFDSLRE", 
"KLKAERE", "KLKKVLSANTNAPFSVE", "KLSGIANNRDE", "KLVAVLK", 
"KLYVGRAQKKNE", "KMIKPKEGRIE", "KMSSGYYLGE", "KMSTRAAPFEQRLPE", 
"KNLFTGWVDVKLSAKGQQE", "KNLKPLAIIKGWGE", "KNMDAATALVGSGPAFVLLMLE", 
"KNVPLYQHLAD", "KQLYSFDLE", "KQNLLAVE", "KRVSGMFLGE", "KSPFLDALKAKNFE", 
"KTFVNVAKPFHKE", "KTKLQGMLNKAEE", "KTMGAKITKSLE", "KTQAFKKHVDE", 
"KTVRKHLERQGWIE", "KVFNAYPAARE", "KVGLRLSPYGVFNSMSGGAE", 
"KVILKMKE", "KVIRFQEE", "KVSVLKALGAE", "KYFPGLLRATNE", "KYSLAPVAKE", 
"LAKKQKKLE", "LDALIAQGRE", "LDASNKAAKE", "LDLARPIYLPTASYGHFTNQE", 
"LDTAQKHID", "LDTIRNME", "LEARIPE", "LFAKFGPIVSASLE", "LFAKHGE", 
"LFDTHRVIVNE", "LFLKQLVVGGLDRVYE", "LFRSIGGE", "LGAVALKGALAKVPE", 
"LGAVNLHE", "LGDKAVYAGE", "LGDNAVFAGE", "LGGEKKQKGQALQF", 
"LGGKSPNIVFADAE", "LGGTVVSLSDSKGCIISE", "LGILPRDILTKE", "LGIYSHE", 
"LGKGSFKYAWVLD", "LGKVLAKVIGKE", "LGMLAGADRVE", "LGTPFGVTIDFE", 
"LHGNAKKAAEE", "LICSYRSKIETE", "LIGGSADLTPSNLTRWKE", "LIHQNEVPLVLLSSGVGVTPLLAMLE", 
"LIHSKVGGE", "LIKLTGKLIE", "LILNGGFSPLTGFLNE", "LINNLGTIAKSGTKAFME", 
"LKADLRPLQIKSIRE", "LKAHNINVVDK", "LKAQSKPHVGDE", "LKHLVGPEKAAE", 
"LKIQRPLHE", "LKKKGILFVGSGVSGGEE", "LKKQKTAE", "LKKQQKEAE", 
"LKKSANVGKKKE", "LKPTVILKLLKE", "LKRAIDLNKE", "LKRIMINCFNE", 
"LKRIPE", "LKTNGKFQVDKSIIE", "LKYFGKALE", "LLAAFKAYLE", "LLAVPVVKGRKTEKE", 
"LLAYQFASPVRWIE", "LLESPNNKVVPATNQIE", "LLKTNRISNE", "LLKTNRISNEQYE", 
"LLLLDVAPLSLGIE", "LLLQQRATE", "LLRLVLLE", "LMAKLANDSPLAIE", 
"LNAATGSKTSLYDKKE", "LNAAYAADGYARIKGMSCIITTFGVGE", "LNKGLTKKGGNIPMIPGWVMEFPTGKE", 
"LNNAAAKKYDLE", "LNQLLKLVSE", "LPAWSKLQKIYE", "LPGVAFLSEKK", 
"LPKNSTSSKDKKKKN", "LQAQLDYLNAE", "LQDIANPIMSKLYQAGGAPGGAAGGAPGGFPGGAPPAPE", 
"LQGKLTGMAFRVPTVD", "LQGKLTGMAFRVPTVDVSVVD", "LRPLQFKSIRE", 
"LRQATGGQAFPQMVFD", "LSALNGIAGSYAE", "LSFALIHKE", "LSFPFEWAFAGTNE", 
"LSGIPPAPRGVPQIE", "LSKISGVDSSLIFPALE", "LSKSKTSPYVLPVPFLNVLNGGSHAGGALALQE", 
"LSLLFNVIPDRYTKYD", "LSNVINMFFE", "LSQGTWLNKPKSVFQE", "LSRIGEFE", 
"LTQFPAFVTPMGKGSIDE", "LTQLKKE", "LTSLTDYVTRMPE", "LTVKLNKE", 
"LVARVQGGEE", "LVFGQTFTDHMLTIPWSAKE", "LVGRINGQFGTVE", "LVILGDSNVVRE", 
"LVKVGHDNLVGE", "LVRDNKLIGNFTLAGIPPAPKGVPQIE", "LVRFSYGQDLE", 
"LVSLPNIILTPHIGGSTEE", "LVTAPLDGTILE", "LYGNIVMSGGTTMFPGIAE", 
"LYGTAIGARSQGAKTYLE", "LYPGRPLAIALD", "LYPGRPLAIALDTKGPE", 
"LYSTSSSSTSSSATKN", "MATLYDGLE", "MAVAIKKE", "MAVKFGKNAF", 
"MFFVSKVMNNE", "MFNDFLNAGAE", "MGQKKAPDGRIVE", "MIGSVVGIYNGKAFNQVE", 
"MIGSVVGIYNGKAFNQVEIRPE", "MIISSPSDGQVKE", "MIVLHLPSPVTAQAYRAE", 
"MKPTSIEKE", "MLAQDKLVAE", "MLGHYLGE", "MLGNWSFGDYFKKE", 
"MLNRISPKILDE", "MLRAAGKE", "MNNIIAASRRH", "MPPQIPNE", "MQTAAQSSSIE", 
"MQTEIKE", "NAHLKKNFKPQGSIE", "NALKLAKWLE", "NAVDRLLVE", 
"NFAPFLKTILPE", "NFIQSIME", "NGFINNPIVISPTTTVGE", "NGHSPSEAFNE", 
"NGITFPKDAPSPFIFKTLE", "NGIVTYAAKE", "NGLLSFVQYVIAPIQE", 
"NGLTAYRLGKE", "NGSFLLYIDRHLVHE", "NGTVTAANASPINDGAAAVILVSE", 
"NGVAKGSFKD", "NISNNYMIGAINAE", "NKERILTE", "NKIIRMPLVE", 
"NKIVRKPLME", "NKKVIITGAPAAFSPTCTVSHIPGYINYLDE", "NKVQYIAGARPWTHVQKVDIALPCATQNE", 
"NKVSPADAAKKAL", "NLHILE", "NLKDTSSGGVTHANE", "NLKKGSTVTSNGLNWE", 
"NLKPSKPSYYLDPE", "NLLPLQSGIGNIANAVIE", "NLTVNPNVNE", "NMKLKLIEPLRE", 
"NNIFNMVVE", "NNIFNMVVEIPRWTNAKLE", "NNMLHGNTMTVTGDTLAE", 
"NNYKKRLLGTAFKSSPFGGSSHAKGIVLE", "NQGLKTATYPYWANE", "NQQGVNNFDE", 
"NRGIKVANPVWSTIPFISE", "NRKISAVSTYFE", "NRNVGKTLVNKSTGLKNASDALKGRVVE", 
"NRNVGKTLVNKSTGLKSASDALKGRVVE", "NRVKSDMLKE", "NSLLSSGTSQDSLRE", 
"NTQLMNRDNIE", "NTSLSPKFVYQGE", "NVKTDSRNMPVKE", "NVQLYNGFVFHTGSLEE", 
"NVQNGEVRFE", "NVRDKGNSALLE", "NVSSNIVKNAE", "NYNLLDTSGVAKVIE", 
"NYTVERVNE", "PKLVLVRHGQSE", "PKLVLVRHGQSEWNE", "QAKLTAATNAKQ", 
"QAVGGIYSVLNKKRGQVVSE", "QDKKKKSNH", "QDPSKSKVVVFE", "QDVPLIVPVVNPE", 
"QGAQVLFASTDSE", "QGKPYISLPKGKGIKLSIAEE", "QGLKIDGPGFE", 
"QHPRYGGVYVGTLSKPE", "QHPRYGGVYVGTLSKPEVKE", "QISSMVLGKMKE", 
"QIVYALKLPGIIHIDAAE", "QLADYLIGVQY", "QLASQLVDLKKE", "QLGIHYE", 
"QLYKNDSNNNNNNNGNNAE", "QQGKNATVSVEE", "QRPGTPLFTVKAYLPVNE", 
"QRTKVEHVRE", "QSPRPGQQAFE", "QSPYVSWVSYPGLASHSHHE", "QSTKFGTEIITE", 
"QTYKKPTGGIVTVRSE", "QVADISSAKVNFKSLE", "QVAKWVNLAQKE", "RAVPHGKWQDE", 
"RDLIKKKTKNNE", "RFLNVFPKLVEE", "RGEIKKGE", "RGLPVKLTYTDNKTSKE", 
"RHIQVGDGLE", "RLAIVGVE", "RLLWYLARE", "RLNTASIPE", "RLNTASIPENVE", 
"RLTSLNVVAGSDLRRTSIIGTIGPKTNNPE", "RLVAIAEQD", "RMHVLKKQYE", 
"RNAAYQKE", "RNAAYQKEYE", "RNKIHQYLFQE", "RQLNAVLE", "RQLNAVLEE", 
"RTSLFLNLANDPTIE", "RTVLFPIKYHE", "RVKANAAKRAE", "RYKLVPGIFADVKNLKE", 
"RYKYVDPNVLPE", "RYVFLLDPMLATGGSAIMATE", "SALSYAALILADSE", 
"SCKMPQTVE", "SDKSKWLTGVE", "SEYWPRLTKE", "SFAANWGVMVSHRSGETE", 
"SFQAVYNKLTGKQIVFE", "SGSKLKFYVLHGDGVE", "SGTLGTKGNTQVIIPRLTE", 
"SGTVFDSSYSRGSPIAFE", "SHIGVAKKLE", "SHLIPSATTGE", "SIAVLSAMKME", 
"SIAYSLKNTISE", "SIQKTKE", "SIRVGEYNAE", "SISDSLSSKPHNFE", 
"SKFAKAYAQGVSKKE", "SKFKGDITWLPVRRKAYWE", "SKLPTYTAKDSAVATRKLSE", 
"SLDQAWSLLRIYPKE", "SLGSPSGATKARIVVAKSGEL", "SLIDAKTGLPKE", 
"SLKTGNAGPRPACGVIGLTN", "SLQNKGQEVKE", "SLRGLGGILLNPITGRRFVNE", 
"SLSSKLSVQD", "SNLKKITLE", "SNPTAKLNLIWPATPIHIKKYE", "SQGKTLSVKQE", 
"SQLTNLFNEE", "SQRIASKNQLE", "SRFQEIVKE", "SRKLFAATVAKAKTIVWNGPPGVFE", 
"SSANRKIVKE", "STKNGTETKRSLE", "STPDTPSPLIAVNE", "STVAGFLVGSE", 
"STVLQFKE", "SVKLTKAVAE", "SVLAHL", "SYQKSQKSQKE", "SYVDKHPVVTFNQE", 
"TAGLTVGDPVLRTGKPLSVE", "TAIGPSGQLKGYLRPE", "TAKGNYPINAVTTMAE", 
"TAQGQFLNFNKLLE", "TARSTATGPSEAVWYGPPKAANLGGVAVSGLE", "TDPFKLSGAQVVD", 
"TEPLGTAGPLKLAE", "TFKLFNKYRPE", "TFRTTNTL", "TGGPISVPVGRE", 
"TGIVAQYAYVLGELE", "TGVIKPGMVVTFAPAGVTTE", "THINLKVSDGSSE", 
"TIGNPKYNVPDFE", "TIQDKSSAGAVVVANAKSLE", "TKAGVVKGKTLLE", 
"TKKSCCSGK", "TKNFTPEQISSMVLGKMKE", "TKTFSPQE", "TKYLSGIAKRLNKE", 
"TLKKFGEE", "TLKQLNASLADKSYIE", "TLKVVDPE", "TLRKVVKHFIDE", 
"TMKAVVIE", "TMWDTKKE", "TNPGTDVTVSSVE", "TQALLLAPIAPHFAE", 
"TQKGVIFYE", "TRLSLTHMVE", "TSGSTVNDPLANYE", "TSNFIKKVGYNPKTVPFVPISGWNGDNMIE", 
"TSSKKPKHPLE", "TTAMITDIATAPAE", "TTHIKFASDPGCAFTKSIGFE", 
"TTTGVHHLYRMVKE", "TVAASAVAAVFE", "TVAKSKNAE", "TVFAGQKP", 
"TVLRQALGE", "TVQVNLPVSLE", "TVSKMAYLDKTGE", "VAAIMQDPVMQSILQQAQQNPAALQE", 
"VAALAAENK", "VAKVVGANPAAIKQAIAANA", "VANPIMSKLYQAGGAPE", 
"VARVILTQVGSGPQETNE", "VATRAKQGELLE", "VDASGFRIPQQE", "VDSVLKHMKE", 
"VEGMRWAGNANE", "VFIDFTKE", "VFKFFGFTPE", "VFKFFGFTPEGVAE", 
"VFLNEHPE", "VFVATKE", "VGAKGVQLLSSYITEE", "VGASMTRSIQTLE", 
"VGKSVAVDSSE", "VGLKRVVTKAMSSR", "VGTMNVFFVFLNKVTGKKE", "VGVHVLPKILDE", 
"VHFVSNIDGTHIAE", "VIAGNVVTRE", "VIDTILALVKD", "VKILNGFAFVE", 
"VKVVLFNHSQRD", "VLANYLTSALSE", "VLAVQKKLIAKSNLAGKPVICATQMLE", 
"VLGPFAFRIGSVKE", "VLIKRGVKPE", "VLLLDVTPLSLGIE", "VLLVAVGRRPYIAGLGAE", 
"VLNPQIIKDVLE", "VLPRAVGSLTFDE", "VLVLRGTLE", "VLVVRGSKKGQE", 
"VLYTSKLSRAIQTANIALE", "VMSIGRTFEE", "VMTKNPVTGIKGITLKE", 
"VQNSTLAQLTSKLIPE", "VQSAVLGFPRIGPNRE", "VRVTPTKTE", "VSAAYKNSLE", 
"VSDVAQKAE", "VSGLQYIDLLLIHSPLE", "VSNPNIIFFRGTYAAVSPE", 
"VSNPPAYGAKIVAKLLETPE", "VSNRSTPSVVGFGPKNRYLGE", "VSSMPTLIFYKGGKE", 
"VSVVDLTVKLNKE", "VTAALRVTD", "VTPLVQNVTGDKE", "VTRVVGANPAAIKQAIASNV", 
"VTSSFFYRGNYTDFE", "VVALNDPFITND", "VVKILRE", "VVLPVDFIIAD", 
"VVLTHPADE", "VVNIGIGGSDLGPVMVTE", "VVTSASAPPENASE", "VVVITKNVSGQDVAAALE", 
"VYHNLKSLTKKRYGASAGNVGDE", "VYKIGGIGTVPVGRVE", "WAGLGKIDRE", 
"WFDIKAPSTFE", "WFRIYKIPDGKPE", "WGKFLTCVEVE", "WLFKLREE", 
"WMWNQLGNFLQE", "WSKLISE", "WSLTAPLGKALHDLS", "WTKIFKAIHE", 
"YAQLLAKRLSE", "YAQLLAKRLSERKAE", "YFATHITE", "YFATHITERE", 
"YFQLLNSALTE", "YGYSARVVDLIE", "YGYSTRVVD", "YGYSTRVVDLVE", 
"YIALVDQLIAKYSS", "YIASKKGSISAE", "YKDIPVPKPKANE", "YKPLFTE", 
"YLLKAIKE", "YLNLPEHIVPGTYIQE", "YNKIGDILSGRLKLRAE", "YQSKIIVFPRDGKAPE", 
"YQTQVLKNAKALE", "YQYLRSVVNE", "YRKVLPIVSVPE", "YRLSVLPDNVPIMSVE", 
"YSLLAWTNIPRKE", "YVAKVSARE", "YVNKGQDFHIAGE", "YVPSVIEPSFGIGRIIYSVFE", 
"YVQAAKNSIAAGADGVE"), class = "factor"), variable = structure(c(1L, 
1L, 1L, 1L, 1L, 1L), .Label = c("BiotinControl1_2", "BiotinControl2", 
"BiotinControl3", "BiotinTreatment1_2", "BiotinTreatment2", 
"BiotinTreatment3"), class = "factor"), value = c(3893050.501, 
900604.6087, 90008.14298, 656399.2021, 359937.85, 447089.3547
)), .Names = c("id", "Sequence", "variable", "value"), row.names = c(NA, 
6L), class = "data.frame")

さて、警告について何か。それは私のコードに重大な問題があると思います。

1: In anova.lm(lm(value ~ variable, data = x)) :
ANOVA F-tests on an essentially perfect fit are unreliable
2: In anova.lm(lm(value ~ variable, data = x)) :
ANOVA F-tests on an essentially perfect fit are unreliable
3: In anova.lm(lm(value ~ variable, data = x)) :
ANOVA F-tests on an essentially perfect fit are unreliable
4: In anova.lm(lm(value ~ variable, data = x)) :
ANOVA F-tests on an essentially perfect fit are unreliable

そして、それは私がループで使いたい単純な関数です:

aov.test <- summary(aov(tbl_reo$value_column ~ as.factor(tbl_reo$variable)))

tbl_reo[,5]  <- aov.test[[1]]$'Pr(>F)'[1]

それを手伝ってくれる人はいますか?最後にお願いするだけで、この小さなスパムで申し訳ありません。

4

1 に答える 1

1

たとえば、パッケージddplyから使用できます。plyr

ddply(tbl_reo,.(Sequence),transform,pv= anova(lm(value ~ variable))$"Pr(>F)"[1])
     id          Sequence           variable      value        pv
1    75   AAAAGAAAVANQGKK   BiotinControl1_2 3893050.50 0.9351210
2   192   AAAAGAAAVANQGKK   BiotinControl1_2  900604.61 0.9351210
3    75   AAAAGAAAVANQGKK     BiotinControl2 2717893.32 0.9351210
4   192   AAAAGAAAVANQGKK     BiotinControl2  741299.33 0.9351210
5    75   AAAAGAAAVANQGKK BiotinTreatment1_2 3435216.40 0.9351210
6   192   AAAAGAAAVANQGKK BiotinTreatment1_2  818936.89 0.9351210
7  3770     AAFTKLDQVWGSE   BiotinControl1_2   90008.14       NaN
8  3770     AAFTKLDQVWGSE     BiotinControl2   87127.07       NaN
9  3770     AAFTKLDQVWGSE BiotinTreatment1_2   85120.95       NaN
10  934 AAIKFIKFINPKINDGE   BiotinControl1_2  656399.20 0.1550903
11 1012 AAIKFIKFINPKINDGE   BiotinControl1_2  359937.85 0.1550903
12 1970 AAIKFIKFINPKINDGE   BiotinControl1_2  447089.35 0.1550903
13  934 AAIKFIKFINPKINDGE     BiotinControl2  646758.14 0.1550903
14  934 AAIKFIKFINPKINDGE BiotinTreatment1_2 1068384.55 0.1550903
于 2013-10-25T09:57:43.457 に答える