Displaying 1 result from an estimated 1 matches for "diagnosticanalysis".
2005 Aug 03
2
regexpr and portability issue
...g with regexpr() as
well as portability between unix and windoz. I need to extract barcodes from
filenames (which are located between a double and single underscore) as well
as the directory where the filename is residing. Here is the solution I came
to:
aFileName <-
"/Users/marco/Desktop/diagnosticAnalysis/test/MA__251329410021_S01_A01.txt"
t <- regexpr("__\\d*_",aFileName, perl=T)
t.dir <- regexpr("^.*/", aFileName, perl=T)
base.name <- substr(aFileName, t+2, t-2 + attr(t,"match.length"))
base.dir <- substr(aFileName, t.dir, attr(t.dir,"match.lengt...