How to write information fetched from xml files into a table/text in R?
I have parsed xml files in R environment and retrieved desired columns as below -
xmlfiles <- list.files(pattern = "*.xml")
input<-sapply(seq(xmlfiles), function(i){
doc <- xmlTreeParse(xmlfiles[i], useInternal = TRUE)
xpathSApply(doc, c('//phase', '//overall_status', '//primary_condition', '//nct_id', '//intervention_name', '//other_name', '//other_name.1', '//other_name.2', '//other_name.3', '//sponsors.lead_sponsor.agency'), xmlValue)
})
I want to write information fetched from xml files into a table/text but have been facing the following error-
write.table(input, file="output.txt", row.names=F, sep="\t")
Error in data.frame(c("NCT00752076", "Recruiting", "N/A", "cancer cell lines establishment", :
arguments imply differing number of rows: 6, 4, 3, 5
Kindly need your inputs.
• 1,666 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Hello niveditaj20!
We believe that this post does not fit the main topic of this site.
This is not a question about bioinformatics.
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!