RStudio Commands/Basics: Labs 1-4 Flashcards

1
Q

What is the command for square root?

A

sqrt (x)

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

What is the command for assigning a variable title to a number or operation?

A

variable letter/title <- # or operation

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

What is the command for absolute value?

A

Abs (x)

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

What is the command for rounding a number up?

A

Round (X, # of digits to round to)

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

What is the command for identifying the data type of the variable?

A

typeof (x)

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

What is the command for confirming the data type of the variable?

A

is.typeofdata (x)

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

What is the command for creating a vector?

A

c(x, x, x, x, x, x…)

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

What is the command for titling a vector?

A

title of vector <- c(x, x, x, x, x….)

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

What is the command for repeating vectors?

A

variable title <- rep(value, times=# to be repeated)

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

What is the command for a sequence of numbers?

A

from#:to#

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

What is the command for combining vectors of data to make a data frame?

A

data_name = data.frame(variable_1….,variable_f)

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

What is the command for isolating data that meets a certain condition?

A

subset(data_name, condition of subset)

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

What is the command for filtering items of the same data?

A

data_name%>%filter(vectortitle==”item wanted”)

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

What is the command for calculating the mean of a vector?

A

mean(data_name$vector name

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

What is the command for calculating a summary of the data in a vector (IQR, Q1, Median, Q3, min/max)?

A

summary(data_name$vector name)

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

What is the command for creating a histogram?

A

hist(data_name$vector name)

17
Q

What is the command for adding a title to a histogram?

A

histogram command, main=”title of histogram”

18
Q

What is the command for importing a csv file into R?

A

read.csv(“pathway/file_name”)

19
Q

What is the command for installing a package?

A

install.packages(“name of package”)

20
Q

What must be around each piece of CHARACTER data when creating a vector of it?

A

quotations must be around each individual piece of data in order to create a vector of it
ex. c(“yes”, “no”, “yes,”, “yes”, “no”…)

21
Q

Which package must be installed in order for filtering a vector to be possible?

A

package “dpylr”

22
Q

What are the 4 types of data in R?

A
  • numeric (double)
  • integer (L notation used to indicate integer)
  • character (strings)- alphabet, number/symbols, “” must be used to indicate that the data is character data
  • logical (T or F)
23
Q

What is the command for creating a boxplot?

A

boxplot(data_name$variable, ylab= “y axis label”, main= “title of boxplot”)

23
Q

What is the command for labeling individual values from a dataset?

A

levels(data_name$variable) <-c(“label of choice” = value of interest)

24
Q

What is the command for physically printing the name of the value?

A

print(data_name$variable wanting to be labeled from levels command)

25
Q

What is the command for creating a matrix?

A

matrix_name<-(data_vector, nrow=, ncol=)

26
Q

What is the command for creating a 2x2 contingency table?

A

matrix_name<-matrix(c(vector 1, vector 2…), # of rows, # of columns)

27
Q

What is the command for creating titles for the rows and columns of the contingency table?

A

dimnames(matrix_name)<-list (row label= c(“option1”, “option2”, column label= c(“option1”, “option2”))

28
Q

What is the command for summing up rows and columns?

A

addmargins(matrix_name)

29
Q

What is the command for creating a list (a way of storing information)?

A

list_name<-list(variable1=””, variable2=””, variable3= ““…)

30
Q

What is the command for extracting a specific variable from the list?

A

list_name$variable_of_interest

31
Q

What is the command for calculating proportion of the rows?

A

prop.table(data, margin= 1)

32
Q

What is the command for calculating proportion of the columns?

A

prob.table(data, margin=2)