List and vector in R

Vector, Array, List and Data Frame in R

Category: R January 4, 2014

Vector, Array, List and Data Frame are 4 basic data types defined in R. Knowing the differences between them will help you use R more efficiently.

1. Vector

All elements must be of the same type.

For example, the following code create two vectors.

name y y $name [1] "Mike" $gender [1] "M" $company [1] "ProgramCreek"

4. Date Frame

A data frame is used for storing data tables. It is a list of vectors of equal length.

For example, you can create a date frame by using the following code:

> name age student df = data.frame[name, age, student] > df name age student 1 Mike 20 TRUE 2 Lucy 25 FALSE 3 John 30 TRUE

Related posts:

  1. Java vs. Python [2]: Data Types
  2. R Write a Date Frame to CSV File
  3. Initialize an Empty Vector in R
  4. ArrayList vs. LinkedList vs. Vector
Category >> R

Video liên quan

Chủ Đề