Skip to content

Latest commit

 

History

History
52 lines (41 loc) · 1.09 KB

File metadata and controls

52 lines (41 loc) · 1.09 KB

Code Style & Conventions

R

  • Use tidyverse style: snake_case for objects and functions
  • Limit lines to 100 characters
  • Use <- for assignment, not =
  • Use the package conflicted to resolve package conflicts
  • Use # ---- as section delimiters
  • Always use ggpubr::theme_pubr() for plot themes

Example:

# Data processing ----
processed_data <- raw_data %>%
  dplyr::filter(quality > threshold) %>%
  dplyr::mutate(log_value = log10(value + 1))

Python

  • Follow PEP 8 with 100-character line limit
  • Use snake_case for functions and variables, PascalCase for classes
  • Use type hints where reasonable
  • Format with Black or equivalent

Example:

def calculate_statistics(data: pd.DataFrame) -> dict:
    """Calculate summary statistics."""
    return {
        "mean": data.mean(),
        "std": data.std(),
    }

Shell Scripts

  • Use #!/bin/bash header
  • Comment non-obvious sections
  • Use meaningful variable names in UPPER_CASE
  • Check for errors: set -e at top of script

Example:

#!/bin/bash
set -e

INPUT_FILE="$1"
OUTPUT_DIR="./processed"