# HG changeset patch # User mnhn65mo # Date 1533723784 14400 # Node ID 659820e2aa6176abb20723ab850eb0983f57333f Uploaded diff -r 000000000000 -r 659820e2aa61 tab2csv.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tab2csv.R Wed Aug 08 06:23:04 2018 -0400 @@ -0,0 +1,14 @@ +#!/usr/bin/env Rscript +#Read csv - return tabular +#2 Options for now : sep an header + +args = commandArgs(trailingOnly=TRUE) + +if(args[3]=="TRUE"){ + tabular<-read.table(args[1],sep="\t",header=TRUE) + write.tale(tabular,"out.csv",sep=args[2],row.names=FALSE) +}else{ + tabular<-read.table(args[1],sep="\t",header=FALSE) + write.table(tabular,"out.csv",sep=args[2],col.names=FALSE,row.names=FALSE) +} + diff -r 000000000000 -r 659820e2aa61 tab2csv.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tab2csv.xml Wed Aug 08 06:23:04 2018 -0400 @@ -0,0 +1,73 @@ + + + R + + + + + + + + + + + + + + + + + + + + + + + + + + +**What it does** + +Convert a tabular file to a CSV. + +Transform the tabs to the chosen separator. It is important to specify if the file has a header line. + +------ + +**Example** + +Input tabular : + + "John" "Smith" "2 mySteet, myCity" + + "François" "LeFrançais" "1 rue du Général, Paris" + + "Other" "Random" "Stuff, stuff, stuff" + + +Output CSV : + + "John","Smith","2 mySteet, myCity" + + "François","LeFrançais","1 rue du Général, Paris" + + "Other","Random","Stuff, stuff, stuff" + + + + +------ + +**Arguments** + +Input : tabular file. + +Separator : default is ",". + +Header : True/False. + + + +