Entering edit mode
8.8 years ago
niveditaj20
▴
50
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.