Session Ready
Exercise

Create composite object types

In this exercise you will investigate different types of data objects. There are four objects loaded for you in your environment: vectors numvec1, numvec2, charvec and logicvec which each have 3 elements.

  • numvec1 is a numeric vector with values 1, 2, 3;
  • numvec2 is a numeric vector with values 5, 2, 3;
  • charvec is a character vector with values "red", "green", "blue";
  • logicvec is a logical vector with values TRUE, TRUE, FALSE.

You can view each by typing the name of the object in the console. You will use these objects to create two new composite objects:

  • a numeric matrix nummtx
  • a dataframe dataframe
Instructions
100 XP
  • Create a numeric matrix named nummtx with numeric vectors numvec1 and numvec2 which has 2 columns and 3 rows.
  • Create a dataframe named dataframe from the four vectors numvec1, numvec2, charvec and logicvec.
  • Get the structure of the dataframe dataframe.