Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename a directory from R, when that is not empty?

Tags:

r

How can I rename a directory from R?

I tried:

Warning message:
In file.rename(from = sprintf("content/%s-content", pu_name), to = sprintf("content/%s",  :
  cannot rename file 'content/pu.train2-content' to 'content/train2', reason 'Directory not empty'
like image 309
Daniel Falbel Avatar asked Jan 11 '17 13:01

Daniel Falbel


1 Answers

You could use shell in order to pass an OS specific command to change it:

shell(paste('rename', 
            sprintf("content/%s-content", pu_name),
            sprintf("content/%s", other_name)))

And it should work without needing an empty directory.

like image 182
LyzandeR Avatar answered Dec 14 '22 22:12

LyzandeR