R Data Frames: data.frame()

  • A 2-D tabular data structure in R: like a spreadsheet or SQL table
  • Used for handling and analysing structured data
  • The data in each column in a data fram must be of the same datatype
  • Data Frames are created using the data.frame() function

data.frame() Syntax

    Example 1:

    Accessing Data From A Data Frame

    To access data from a data frame. We can use either of the following:

    • Single[ ] or double brackets¬†[[ ]]
    • ¬†$


    cbind(): Adding Columns in Data Frame

    cbind(): Adding Columns in Data Frame


    Dimensions of a Data Frame: columns and rows

    Leave a Comment

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

    Scroll to Top