str()

str()

The str() function will display the internal data structure of an R object (such as a data frame). It will return information about the rows (observations) and columns (variables) along with extra information like the names of the columns, class of each column, followed by some of the initial observations of each of the columns.

Example:

# Get information about the structure of MindsetMatters

str( MindsetMatters )

Example output:
Example output of str function showing structure of MindsetMatters

    • Related Articles

    • R Objects

      R Objects Overview In R, everything is an object. Data, functions, models, and even results of calculations are all stored as objects. Understanding R objects is fundamental to working with data, writing reproducible code, and performing statistical ...
    • Statistical Model

      A statistical model is a simplified way of describing how data are generated. It helps us separate what we can explain using known information from what we cannot explain perfectly. We use statistical models for three main purposes: (1) to understand ...
    • Vectors

      Vectors Vectors are one of the most basic and important data structures in R. A vector is an ordered collection of values of the same data type, such as numbers, characters, or logical (TRUE/FALSE) values. In statistics and data science, vectors are ...
    • Data Frame

      A data frame is a way to organize data into rows and columns, similar to a spreadsheet or table. Data frames are one of the most common ways to store and work with data in statistics, data science, and R. How Data Frames Work Each row represents one ...
    • Sampling

      Sampling is the process of selecting which individuals, objects, or observations to study from a larger data generating process (DGP). Sampling determines what your data represent and how far your conclusions can generalize. Why Sampling Matters ...