use function system in R
for (x in 1:100){
system (paste(rename file0.,x,_data.RData file,x,_data.Rdata,sep=))
}
-
Yasir Kaheil
--
View this message in context:
http://r.789695.n4.nabble.com/change-file-name-from-file0-1-data-RData-to-file1-data-Rdata-tp4637135p4637136.html
Sent from the R
Dear All,
I want to change file names.
I have file0.1_data.RData (I have several files whose names are
file0.x_data.Rdata)
I want to rename it to file1_data.RData
How can I do it?
Thank you for saving my time!
[[alternative HTML version deleted]]
Hello,
Follow this example.
# First see the regular expression
# at work without changing any disk file
x - c(file0.1_data.RData, file0.2_data.RData)
sub(^file0\\., file, x)
# Now change them
from.files - list.files(pattern = ^file0\\.._data.Rdata$)
to.files - sub(^file0\\., file, from.files)
3 matches
Mail list logo