You can change the output file name if you use the rmarkdown::render
function as it has argument to customise the rendering process
rmarkdown::render(input = "02-googleAnalyticsR.Rmd", output_file = "new_file_name.html")
Moreover, you can customize this inside your Rmd document using the knit:
hook in the YAML header. Using for example an anonymous function
knit: (function(inputFile, encoding) {
rmarkdown::render(inputFile,
encoding=encoding,
output_file='new_file_name.html')) })
With this in the YAML header, when using the knit button in RStudio, this function will be used for rendering. You can use a fix filename like in the example or a computed filename (like with timestamp in it).
More info on this SO question which has some useful links
https://github.com/rstudio/rmarkdown/issues/277