View source: R/rename_r_to_R.R
rename_r_to_R | R Documentation |
Rename files' extensions in a folder from .r to .R.
rename_r_to_R( subdir = ".", recursive = FALSE, message = TRUE, text_to_find = "\\.r$", new_extension = ".R", ... )
subdir |
(character) sub folder from the current working directory in which the files should be changed. Default is "". |
recursive |
(logical) FALSE. Should the function keep going into folders and check them as well? |
message |
(logical) should we output how many files were changed. (default is FALSE) |
text_to_find |
old file extension (should have $ at the end!) |
new_extension |
new file extension... |
... |
not used. |
This came after a discussion with Hadley, JJ, and Martin leading to the realization that since we are using the R language (and not the r language), the standard is to use .R files instead of .r
Be careful when using the recursive argument. And remember that source("miao.r") and source("miao.R") Are NOT the same...
(integer) the number of files changed
## Not run: rename_r_to_R() # changes only .r in the current wd rename_r_to_R("R") # fixing the file ending inside a package directory rename_r_to_R(recursive = TRUE) # Changes rename_r_to_R(recursive = TRUE, message = FALSE) # Changes # ALL of the .r files underneath the current # working directory # source: http://stackoverflow.com/questions/52950/how-to-make-git-ignore-changes-in-case # First run the following in git bash: # git config core.ignorecase false rename_r_to_R(recursive = TRUE, text_to_find="\\.R$", new_extension = ".b") # mmm, since it does not work nicely, you'd need to run the following: # and commit between the two. rename_r_to_R(recursive = TRUE, text_to_find="\\.r$", new_extension = ".b") # commit! rename_r_to_R(recursive = TRUE, text_to_find="\\.b$", new_extension = ".R") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.