3 Naming projects and files
3.1 Naming your project
Creating useful and meaningful project names is important for clarity and ease of understanding. Here are some tips for creating effective project names:
3.1.1 Be Descriptive
- Reflect the Purpose: The name should give an idea of what the project is about. For example,
customer_segmentation
is more descriptive thanproject1
. - Use Relevant Keywords: Include keywords that are relevant to the project’s objectives. For example,
sales_forecasting
for a project focused on predicting sales.
3.1.2 Keep It Concise
- Short and Sweet: Aim for a name that is short yet descriptive. Avoid overly long names that are difficult to remember and type.
- Avoid Unnecessary Words: Remove filler words that don’t add value, like “project”, “analysis”, or “data”. For example, use
market_analysis
instead ofmarket_analysis_project
.
3.1.3 Use Consistent Naming Conventions
- Consistency: Stick to a consistent naming convention across all your projects. This could be
snake_case
,camelCase
, orkebab-case
. - Versioning: If you have multiple versions of a project, use a consistent versioning scheme, such as
v1
,v2
, etc.
3.1.4 Avoid Special Characters
- Limit Special Characters: Avoid using special characters that might cause issues in file systems or version control systems. Stick to alphanumeric characters, hyphens, and underscores.
3.2 Naming individual files
3.2.1 Be Descriptive
- Reflect Content: The name should indicate the file’s content or purpose. For example,
sales_data_2023.csv
is more informative thandata.csv
. - Include Relevant Details: Add key details such as dates, versions, or subjects. For instance,
meeting_notes_2023-06-13.txt
.
3.2.2 Keep It Concise
- Short and Clear: Aim for names that are concise but still convey the necessary information. Avoid overly long names.
- Eliminate Redundancies: Remove unnecessary words or repetitions.
3.2.3 Set order with prefix
- Script order: When using multiple scripts that should be run in a specific order use a numerical prefix in the file name (e.g.,
01_process-data.R
,02_create-model.R
,03_make-plots.R
). Always start with a leading 0 (e.g.,01_ex.R
) so that the file order can still be sorted by name if you end up having ten or more scripts. - Date order: If you have multiple version of the same or similar outputs you cause the date prefix in the name so that they can be sorted in order (e.g.
2024-01-01_incidence-map.png
,2024-02-07_incidence-map.png
). Be sure you use theYYYY-MM-DD
format so that the correct order will be maintained. - Break prefix with standard character: I like to use
_
to separate my prefix from the rest of the file name, which would then only contain-
and never underscores. This makes it easy to parse the prefixes.
3.2.4 Use Consistent Naming Conventions
- Establish a Pattern: Decide on a consistent naming convention and stick to it, such as:
snake_case
:file_name_example.txt
camelCase
:fileNameExample.txt
kebab-case
:file-name-example.txt
- Standardized Components: Ensure consistent use of components like dates (
YYYY-MM-DD
format is often recommended) and versions (v1
,v2
).
3.2.5 Avoid Special Characters
- Limit Special Characters: Avoid using spaces and special characters (e.g.,
! @ # $ % ^ & *
) as they can cause issues in some systems. Use hyphens or underscores instead.
3.2.6 Use Meaningful Abbreviations
- Clarity Over Brevity: Use abbreviations that are widely understood and avoid overly obscure ones. For example,
jan_sales
is better thanjs
.