| Title: | Use R Markdown to Write your "Rprofile" | 
| Version: | 0.1.1 | 
| Description: | A simple way to write ".Rprofile" code in an R Markdown file and have it knit to the correct location for your operating system. | 
| License: | MIT + file LICENSE | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.1.2 | 
| Suggests: | testthat (≥ 3.0.0) | 
| Config/testthat/edition: | 3 | 
| Imports: | fs, rmarkdown, knitr, rlang, withr | 
| URL: | https://github.com/jameslairdsmith/customiser | 
| BugReports: | https://github.com/jameslairdsmith/customiser/issues | 
| NeedsCompilation: | no | 
| Packaged: | 2024-07-08 13:27:42 UTC; jameslaird-smith | 
| Author: | James Laird-Smith | 
| Maintainer: | James Laird-Smith <jameslairdsmith@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2024-07-08 13:50:02 UTC | 
customiser: Use R Markdown to Write your "Rprofile"
Description
A simple way to write ".Rprofile" code in an R Markdown file and have it knit to the correct location for your operating system.
Author(s)
Maintainer: James Laird-Smith jameslairdsmith@gmail.com (ORCID) [copyright holder]
See Also
Useful links:
- Report bugs at https://github.com/jameslairdsmith/customiser/issues 
Create your .Rprofile from R Markdown
Description
Mainly useful as the "knit:" parameter of an R Markdown file. A document with this option will have its R code made into the contents of the appropriate .Rprofile file for the user's operating system.
Usage
customiser(file, ..., quiet = FALSE)
Arguments
| file | Character. The R Markdown file from which to extract code. | 
| ... | For future extensions and must be empty. | 
| quiet | Logical. Whether to silence the confirmation message.
 | 
Details
The function always writes the .Rprofile to R's home directory as determined
by fs::path_home_r(). If you wish to overwrite this behaviour, you can
set the "customiser.r_home" global option to the target directory of your
choosing.
Value
Invisibly, a string with the location of the .Rprofile file being written to.
Examples
library(withr)
my_rmarkdown_file <- rmarkdown_simple()
tmp <- tempdir()
with_options(list(customiser.r_home = tmp), {
  customiser(my_rmarkdown_file)
})
file.exists(file.path(tmp, ".Rprofile"))
Example R markdown files
Description
Exclusively for testing and demonstration, the package comes with a few simple R Markdown files.
Usage
rmarkdown_simple()
rmarkdown_no_overwrite()
rmarkdown_allow_overwrite()
Value
Character path to the example file.
Examples
rmarkdown_simple()
rmarkdown_no_overwrite()
rmarkdown_allow_overwrite()