Programming in R Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Five basic or “atomic” classes of objects in R

A
  • Character
  • Numeric (Real Numbers)
  • Integer
  • Complex
  • Logical (True/False)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The most basic object in R

A

A Vector - can only contain objects of the same class (except lists)
- Empty vectors can be created with the “vector()” function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Attributes of R objects?

A
  • Names, dimness (dimension names)
  • Dimensions (matrices, arrays)
  • Class
  • Length
  • Other
  • Accessible using the “attributes()” function
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What operator is used in R to create an integer sequence?

A

A colon eg. [1:20]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is “coercion” in R?

A

This is when objects in R are mixed in the same vector and so R simplifies to the least common denominator to make them of the same class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a matrix in R?

A

A matrix is a veto with a dimension attribute. The dimension is itself an integer vector of length 2 (now, ncos)

Matrices are constructed “column-wise” starts at the top of a column and goes down through rwo, then start top of next column until complete.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Whit is cbind-ing and rbinding of matrices in R?

A

Column-binding and row-binding with cbind() and rbind(); cbind() lists the objects in a vertical order, rbind() in a horizontal order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a list in R?

A

Lists are a special type of vector in R that can contain elements of different classes. lists are very important in R. and used for many things. Elements in lists have double brackets around them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a “Factor” in R?

A

A Factor represents categorical data that is ordered or unordered, like an integer vector where each integer has a label (eg/ Male and Female instead of 1 and 2.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly