RStudio: save the order of opened source files when opening project?

I've got a set of files contained in a folder that's associated with a .Rproj file. For the sake of example, let's say I have the following files:

  • file-01.R
  • file-02.R
  • file-03.R
  • file-04.R
  • file-05.R

These files are intended to be run in sequential order, which I have another script that will do. However, for ease of editing, I'd like the scripts in the source pane to be open in the order that they get run. At some point, they were opened in a different order, so they're currently open like:

  • file-03.R
  • file-01.R
  • file-02.R
  • file-04.R
  • file-05.R

I close them all, re-order the files, and thought based on other things I've read that it should maintain that order. However, when I close that project and come back to it, the files are back to being ordered incorrectly. This doesn't impact the final results, but would be much more convenient if the files would stay in the correct order. I don't know what setting or file would be controlling that, but would appreciate any help in figuring out what's going on!

# Session Info
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
# .Rproj settings
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX
# RStudio Preferences
    "panes": {
        "quadrants": [
        "tabSet1": [
        "tabSet2": [
        "hiddenTabSet": [
        "console_left_on_top": false,
        "console_right_on_top": true,
        "additional_source_columns": 0
    "show_diagnostics_other": true,
    "save_files_before_build": true,
    "editor_theme": "Cobalt",
    "default_project_location": "~/Documents",
    "document_author": "[redacted]",
    "reuse_sessions_for_project_links": true,
    "initial_working_directory": "~/Documents",
    "rmd_viewer_type": "pane",
    "posix_terminal_shell": "zsh",
    "jobs_tab_visibility": "shown",
    "svn_exe_path": "/usr/local/bin/svn",
    "syntax_color_console": true,
    "source_with_echo": true,
    "shiny_background_jobs": true

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.