R Object Naming Conventions

Contents

    R objects should be named according to convention.

    Here are some conventions I think should be utilized:

    First order database tables.

    First order lazy tables. e.g. those created with tbl(dev_con(),"wh_student"), should have their name plus _tbl as a suffix.

    E.g. tbl(dev_con(),"wh_student") -> wh_student_tbl

    _tbl should not be used once additional operations have been applied.

    Good

    wh_student_tbl <- tbl(dev_con(),"wh_student")

    m_wh_students_lt <- wh_student_tbl |> filter(gender == “M”)

    BAD

    wh_student_tbl <- tbl(dev_con(),"wh_student")|> filter(gender == “M”)

    Higher Order database tables

    Second order derived tables (e.g. lazy tables) and above, should use _lt as a suffix. This naming convention is used to

    Good

    wh_student_tbl <- tbl(dev_con(),"wh_student")

    m_wh_students_lt <- wh_student_tbl |> filter(gender == “M”)

    BAD

    m_wh_students_tbl <- wh_student_tbl |> filter(gender == “M”)

    Updated on February 16, 2026

    Leave a Reply

    Your email address will not be published. Required fields are marked *