Glossary

Overview

Learning a programming language is just like learning a spoken language: there are a lot of terms and definitions to learn! To complicate matters for an R / Python bilingualism context like this one, the two programming languages sometimes use the same term with very different definitions attached. To hopefully streamline term acquisition / comparison, I’m compiling a glossary of crucial R and Python terms below.

Note that if a definition has a term in both languages, the definition is given with the terms in the respective languages beneath. If a term is only found in one language it is given first and subsequently defined.

General Terms

  • Data stored for later re-use (regardless of structure/dimensions)
    • Python – variable
    • R – object
  • Category of information stored in a given data variable/object
    • Python – type
    • R – class
  • Downloadable set of functions
    • Python & R – library / package
    • See “Tools” for definition of ‘function’

Data Types/Classes

  • Numbers that are not a fraction (i.e., are a whole number)
    • Python & R – integer
    • Python pandas library – int64
  • Non-integer numbers
    • Python – float
    • Python pandas library – float64
    • R – numeric
  • Text / content stored as text
    • Python – string
    • Python pandas library – object
    • R – character
  • Categorical content with an order among the unique entries (often–though not necessarily–with few unique entries relative to total number of entries)
    • R ONLY – factor
  • Logical values indicating whether conditions are met
    • Python – boolean (True / False)
    • R – boolean (TRUE / FALSE / T / F)
  • Variable/Object holding an ordered sequence of data (can be modified)
    • Python – list
    • R – vector (must be one-dimensional) / list
  • Each component of a list/list
    • Python – item
    • R – element
  • Variable holding an ordered sequence of data (cannot be modified)
    • Python ONLY – tuple [too-pull]

Operators

  • Assignment operator – creates a new variable/object
    • Python=
    • R<- / ->
  • Arithmetic operators – performs basic arithmetic
    • Python & R – addition (+)
    • Python & R – subtraction (-)
    • Python & R – multiplication (*)
    • Python & R – division (/)
    • Python – exponent (**)
    • R – exponent (^)
  • Arithmetic assignment operator – does an arithmetic operation and stores the result in a variable
    • Python ONLY – arithmetic operator and assignment operator (e.g., +=)
  • Relational operators – conditional statements that return boolean values
    • Python & R – ‘exactly equal to’ (==)
    • Python & R – ‘not equal to’ (!=)
    • Python & R – greater/less than (> / < respectively)
    • Python & R – greater/less than or equal to (>= / <= respectively)
  • Namespacing operator – specifies library in which a given function is defined
    • Python – a period package.function (required)
    • R – two colons package::function (optional)

Tools

  • variable/object containing multiple, inter-related operations that are run in a pre-defined order every time the variable/object is used
    • Python & R – function
  • Value sent to a function when called to modify behavior (sometimes optional)
    • Python & R – argument / parameter
  • Function that can only be used on a specific type/class of variable/object that supports arguments (sometimes optional) to modify behavior
    • Python – method (variable.method(...))
    • R – just a special case of function
  • Function that can only be used on a specific type/class of variable/object without arguments to modify behavior
    • Python – attribute (variable.attribute)
    • R – just a special case of function

Data Characteristics

  • Number of items/elements in a variable/object
    • Python – length (len())
    • R – length (length())
  • Number of rows/columns in a two-dimension, tabular variable/object
    • Python – shape (.shape)
    • R – dimensions (dim())
  • Number of characters in a string
    • Python – also length (len())
    • R – number of characters (nchar())