Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Getting started with tibbles
Creating tibbles
Subsetting
Summary
16. Summary

Instruction

Let's review what we've learned so far. We know about four ways of creating tibble:

  • as_tibble() – for converting existing data frames,
    as_tibble(df_orders)
  • tibble() – for creating a tibble by columns,
    tibble(
      name = c("apple", "orange", "pear", "grapefruit"),
      quantity = c(3,5,6,2)
    )
    
  • tribble() – for creating a tibble by row,
    tribble(
      ~name, ~quantity,
      "apple", 3,
      "orange", 5,
      "pear", 6,
      "grapefruit", 2 
    )
    
  • read_csv() – for creating a tibble from a CSV file.
    read_csv("data/fruits.csv")

And we know the proper ways of extracting a column – by using $ with a column name or by using [[...]] with a column's name or position.

Exercise

Click Next exercise to continue.