Skip to content

R analysis: output filenames with spaces #373

Open

Description

@abd1tus

One plotting function names its output file with spaces, so two files are
called ... precinct_assignment avg distance.png and ... solver_assignment avg distance.png while every other output in the repo uses underscores. Spaces need quoting
in every shell command and in the bucket, and the two files stand out as the one exception
to the naming rule. The fix is one line. The catch is the bucket: every past run already
uploaded there keeps the old name, so after the change a browser sees both styles. This
ticket proposes the one-line fix and states that cost plainly.

1. Problem

plot_density_v_distance_bg() in graph_functions.R builds its output filename with
paste(county, descriptor_str, "avg distance.png"). The separator is a space. (Line 694
on the epic branch, 675 on main.) Two tracked files have the result:

  • precinct_analysis_outputs/Monongalia_County_WV/Monongalia_County_WV precinct_assignment avg distance.png
  • precinct_analysis_outputs/Monongalia_County_WV/Monongalia_County_WV solver_assignment avg distance.png

The other 23 tracked files in that folder use underscores. Basic_analysis.r writes the
same plot for each county under result_analysis_outputs/; those files are not tracked,
so the same names exist on each analyst's disk and in the bucket. A dead script,
testing_model_functionality/log_distance_regression.r, has the same pattern at line 170.

2. Effects

  • Spaces need quoting in every shell command and in the bucket object name.
  • The name is the one exception to the repo's naming convention.

3. Proposed change

Change the separator to _ and the fixed text to avg_distance.png:
paste(county, descriptor_str, "avg_distance.png", sep = "_"). Result:
Monongalia_County_WV_precinct_assignment_avg_distance.png.

CAUTION: every Basic_analysis run already in the bucket keeps the old name. New runs get
the new name. Anyone who browses the bucket by hand then sees two layouts, depending on
when a run happened. Renaming the existing objects is the copy-rename-delete job
discussed on #335 on 08-15, and is not part of this change. The two tracked Monongalia
files also keep their names until the #340 follow-up untracks them.

4. Not affected

The cloud upload (#341 and #343, the storage PRs) handles spaces correctly; the 08-24
real-bucket test uploaded these two files at their exact names. This is a naming issue,
not an upload bug.

Refs #335 (the storage-fix issue this was split from), #340 (precinct snapshot upload).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions