I would like help on writing a code in R to extract simple sample header information i.e. sample name, instrument type, date, user, etc from mzXML files and coerce the information into a data.frame of some sort and then use write.table to output it into a .txt or .csv file for easy viewing and cataloging. I am not an expert R user and this is what I have gathered so far. However, it can only return the partial information from one file. Is it possible to run in batch process from an entire directory of say, 1000 files? Please advise, thanks for your help.
library("mzR") file<-list.files("C:/Users/sktrinh", pattern="\\.mzXML$",full.names=T,recursive=T) mz<-openMSfile(file) mz.1<-as.data.frame(instrumentInfo(mz)) mz.1 <- cbind(mz.1, path=file)[,c(6,1,2,3,4,5)] write.csv(mz.1,"C:/Users/sktrinh/mzxml_output.csv")