Hi, all!

I've obtained the enriched GO BP terms using fGSEA in R as shown below.

     1:            GO_POSITIVE_REGULATION_OF_VIRAL_TRANSCRIPTION 0.020378457 0.08797654  0.4748196  1.5113374           13   41 TFAP4,NELFCD,POLR2H,POLR2D,NELFA,DHX9,...
    2:                           GO_CARDIAC_CHAMBER_DEVELOPMENT 0.005847953 0.04827840 -0.3775346 -1.7146207            0  166   TEK,FOXF1,CCM2L,TGFBR3,SLIT3,TGFBR2,...
    3: GO_DNA_DEPENDENT_DNA_REPLICATION_MAINTENANCE_OF_FIDELITY 0.001461988 0.04816766  0.6526836  2.0851705            0   42    EME1,DNA2,TIMELESS,BLM,TONSL,RAD51,...
    4:                                      GO_CIRCADIAN_RHYTHM 0.626463700 0.79544296  0.2392950  0.9379309          534  194  TOP2A,EZH2,TIMELESS,LGR4,NMU,SUV39H2,...
    5:              GO_PHOSPHATIDYLSERINE_ACYL_CHAIN_REMODELING 0.488165680 0.69185315 -0.3223920 -0.9673269          164   21     PLA2G4F,PLA2G5,LPCAT3,PLA2G2A,PLA2G1B
    6:                               GO_SPINAL_CORD_DEVELOPMENT 0.334183673 0.55175132  0.2905675  1.0667585          261  104     MNX1,SOX4,HOXC10,SOX11,LHX5,SOX12,...


What I'm troubling is saving the result to a file. 

I've tried 'write.csv' and 'write_csv', but both failed because the presence of a list (or lists) in the result that I couldn't see.

    > write.csv(fgseaRes,"test.csv")
    Error in write.table(fgseaRes, "test.csv", col.names = NA, sep = ",",  : 
      unimplemented type 'list' in 'EncodeElement'
    > write_csv(fgseaRes,"test.csv")
    Error in stream_delim_(df, path, ..., bom = bom, quote_escape = quote_escape) : 
      Don't know how to handle vector of type list.

Anyone knows how to save this to txt or csv files?

Thank you!
Use fwrite from data.table package:  `fwrite(fgseaRes, file="fgsea.tsv", sep="\t", sep2=c("", " ", ""))`