Hello, I have a list of filenames extracted from a data-frame thus:
files <- main$file e.g. file[[1]] returns [1] Ca00Mn48_0.gout 4702 Levels: Ca00Mn48_0.gout Ca01Mn47_0.gout Ca01Mn47_1.gout ... Ca48Mn00_0.gout I want to extract the substring that contains the two digits after "Ca". This works on individual entries, e.g. substr(files[[1]],3,4) returns "00". I wish to apply substr() to all the entries in files. All my efforts fail. Could some kind soul explain how to do what I want? Thanks, Roger Mason ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.