Difference between list and array in R

Lists

Within R a list is a structure that can combine objects of different types. We will learn how to create and work with lists in this section.

Creating Lists

A list is actually a vector but it does differ in comparison to the other types of vectors which we have been using in this class.

  • Other vectors are atomic vectors
  • A list is a type of vector called a recursive vector.

An Example Database

We first consider a patient database where we want to store their

  • Name
  • Amount of bill due
  • A Boolean indicator of whether or not they have insurance.

We then have 3 types of information here:

  • character
  • numerical
  • logical.

To create a list of one patient we say

a

Chủ Đề