0

I want to parse following file and print it to tabular format like the output

Input.txt

enter image description here

#------Main
rt1=read.delim_1("Row_Merge_data_1.txt", header=TRUE, sep="\t"); colnames(rt1)
rt=as.data.frame(rt1); head(rt1)
rt[is.na(rt)]=""

colnames(rt)
dim(rt)

f_out="Merge_R.txt"
cat("",file=f_out,append = FALSE)
for(i in 1:nrow(rt)){

Symbol=rt$Genes_Info[1,]
FullName=rt$Genes_Info[2,]
Primary=rt$Genes_Info[3,]
Gene_type=rt$Genes_Info[4,]

results= paste(Symbol,FullName,Primary,Gene_type,sep="\\t")
write(results,file=f_out, append=TRUE)
}

Output.txt enter image description here

Phil
  • 7,287
  • 3
  • 36
  • 66
just
  • 1
  • 1
  • Welcome to SO. Please make your post [reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by providing your data using `dput()`. Please avoid posting images of code or data. – jrcalabrese Nov 21 '22 at 02:18

0 Answers0