13.1 The basics

  • Data frames are the usual format for data sets
    • …are "lists" of vectors of the same length under the hood
    • …look like matrices, but columns can contain objects of different class


  • Functions
    • data.frame(): Create a data frame
    • as.data.frame(): Convert into a data frame
    • summary() und str(): Get oversight of a data frame’s content
    • head() and tail(): Inspect the data
    • ``View(): Show data frame (formerlyfix()) + **Beware**.. you can't continue to work when the data window offix()``` is open!
    • names(): Display variablenames (and use to rename)
    • na.omit(): Delete missings “listwise”, i.e. rows that contain at least one missing
    • is.na(): Generate logical vector indicating the missings


  • More
    • object$var1: Access variable var1 in data frame object
    • as.numeric(object$var1): Convert class of variable into numeric
    • NA: What was that?!?!