Could somebody please help me on this?

I have many files on my computer and would like to change its names so that it 
would be more meaningful for me. The filenames are in the following format: 
cvcvcv198307.xlsx

I want to change it in such a way that
cvcvcv into Domain1983 want to keep it 07 into 3-1 * And here is my main 
problem (Explanation below).


Each month (01-12) is divided into three data points. Meaning,

01(Jan) has three data points: 1, 2, and 3
02(Feb) has the next three data points: 4,5, and 6...12(Dec) will have: 34,35, 
and 36


So, 01 (last digit in my file name) means, first month, first data point, i.e. 
1-1

    02 - First month, and second data point, i.e. 1-2

    03 - First month, third data point, i.e 1-3

    04- second month, first data point, i.e. 2-1

    05- 2-2

    06- 2-3

    07 - 3-1

    08 - 3-2

    09 - 3-3

    10 - 4-1

    11 - 4-2

    12 - 4-3

    .

    . 

    .
       35 - 12-2
       36 - 12-3

And that's all.

I have tried file.rename along with sapply for my whole sets of data

(1:18,000). But i can only manage to change the file names before the last two 
#digits.

Expected result.

The whole file names changed from


cvcvcv198307.xlsx into Domain1983-3-1.txtcvcvcv198414.xlsx into 
Domain1984-5-2.txt




(Yes, file name extension too!)

Thank you guys and I really appreciate any help on this.
Daniel



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to