R Flashcards

1
Q

Rules for naming objects in R

A
  • Names can include letters, numbers, periods (.), and underscores(_)
  • They must begin with a letter or a period. If period it can’t be followed by digit.
  • Reserved words like if, else, TRUE, FALSE, NA, etc., can’t be used. To find out
    about reserved word in R, you can type
    > ?reserved
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the # do in R?

A

It is a naming method to add comments are lines in code to explain, notes, descriptions that are not executed as part of the program.

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

What is a function?

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

Functions generic syntax

A

function_name (argument1,…,argument = defaultt…)

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

What does ? do

A

if you need help on info about a function

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

Basic data types of R

A

Numeric data (double, integer)
String data (character)
Logical data (logical)

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

&

A

Logical operator AND
returns TRUE if both conditions are TRUE, otherwise returns FALSE.

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

|

A

Logical Operator for OR
Returns true if at least one of the conditions is TRUE, or otherwise returns FALSE.

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

!

A

NOT negates the logical value of a condition.

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

Precedence in logical operator

A

1) NOT 2) AND 3) OR

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

Vectors

A

fundamental data structure that allows you to STORE A SEQUENCE OF ELEMENTS OF THE SAME DATA TYPE.

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

c()

A

function combine to create a vector by combining elements of the same type.

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

Types of vectors

A

Numeric vectors: Contains numeric values (integers or decimals).
Character Vectors: Holds text or strings.
Logical Vectors: Consists of TRUE or FALSE values.

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

What happens when you compare a vector and an atomic value using operator like > < ==?

A

Each element within the vector is INDIVIDUALLY compared to the atomic value

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

length()

A

determine the number of elements in an object

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

Subsetting

A

Element extraction from a vector. Allows you to extract specific elements or subsets of elements from a vector based on different conditions or indices.

17
Q

name [index/indices]

A

subsetting

18
Q

which()

A

indexes of TRUE’s of the vector in its argument

19
Q

tidyverse

A

A library that consists of a set of R packages tailored for data science tasks

20
Q

Data.frame()

A

Data Frame in Base R used to store tabular data like spreadsheets. Like matrices, they have rows and columns. Unlike matrices, they can store
different classes of objects in each column.

21
Q
A