Common Functions Flashcards

1
Q

getwd()

A

Get working directory

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

setwd(“x”)

x is path to working directory

A

Set working directory

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

install.packages(“x”)

x is package name

A

Installs package

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

library(x)

x is package name

A

Load a package

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

print(x)

x is a variable

A

Display contents of a variable

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

nrow(df)

df is a data frame

A

Determine the number of rows in a data frame or matrix

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

ncol(df)

df is a data frame

A

Determine the number of columns in a data frame or matrix

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

rm(x)

x is a variable

A

Delete a variable from your programming environment

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

read_csv(“data.csv”)

data.csv is a file

A

read a CSV (comma-separated value) file and create a data frame

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

write.csv(“output.csv”)

output.csv is a file

A

exports the data frame as a csv file

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

sd(df$Age)

Age is a column in the data frame

A

Calculate the standard deviation

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

help(package = “x”)

x is a package name

A

find help for a package

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

mean(df$Age)

Age is a column in a data frame

A

calculate the average

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

summary(df)

df is a data frame

A

provide a summary of descriptive stats for each variable in a data frame

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

head(df)

df is a data frame

A

View the first few rows of a data frame or matrix

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

tail(df)

df is a data frame

A

View the last few rows of a data frame or matrix

16
Q

str(df)

df is a data frame

A

Display a structure of a data frame or matrix