R Functions Flashcards

(118 cards)

1
Q

abline()

A

Adds straight line to a plot. v = “” puts a vertical line at corresponding to a specific coordinate.

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

abs()

A

Absolute value

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

apply()

A

apply(x, margin, fun)
x = dataframe, matrix, etc.
margin = parameter
fun = function to apply to data

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

as.character()

A

convert to character vectors

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

as.numeric

A

converts data to numeric values

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

as.vector

A

converts data to a vector (returns r vector)

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

attach()

A

turns all variables in dataframe into their own objects

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

barplot()

A

creates a barplot

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

boot()

A

IDK

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

boot.ci()

A

IDK

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

boxplot()

A

creates a boxplot

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

by()

A

localized function. allows us to apply a function toa certain subsect of a data frame
by(data, indices, fun)
data = dataframe, vector, etc.
indices: defines data points that will be split into certain subsets
fun: function that will act on component
AKA by() performs FUN on DATA for each INDICE

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

c()

A

concatanate. combines things into a vector

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

calcTemp()

A

IDK

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

cbind()

A

combines multiple vectors (or matrices or dataframes) by their columns

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

cex()

A

allows u to change size of characters

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

class()

A

IDK

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

cleanNHdata

A

IDK // i mean i kinda do know but is this a real fx they would want us to use…

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

colnames()

A

returns OR sets the names of columns
to set names of columns:
colnames(df) <- c(“x”, “y”, “z”)

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

colors()

A

specifies color (usually in a plot of some sort)

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

colSums()

A

IDK/come back

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

complete.cases()

A

IDK/come back

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

convertTimes()

A

IDK/come back

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

data.frame()

A

turns something into a data frame? IDK/come back

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
dbinom()
IDK/come back
26
demo()
27
dexp()
28
dim()
Gives the dimensions of a dataset (amount of rows and columns)
29
dirname()
30
dnorm()
31
droplevels()
remove old/previous factor levels
32
duplicated()
determines which elements of a dataset are duplicates --> returns a true/false vector
33
exp()
calculates the power of e for whatever the input is. as in e ^ input
34
factor()
encodes a vector as a factor (turns a column from numeric to factor).
35
for()
creates a for loop. syntax: for(variable in vector) {statement(s) } * i is generic variable
36
function()
creates a function. syntax function() { print("something") }
37
glm()
irrelevant
38
gsub()
finds and deletes segments. gsub(what to replace, "replacement", dataframe)
39
head()
40
help()
41
hist()
42
hms()
43
install.packages()
44
intersect()
45
is.na()
if set to false, removes na values
46
las()
makes labels horizontal or parallel to axis. las = 0 is parallel, las = 2 is perpendicualr (0 is the default)
47
legend()
adds legend to plot. legend(topright, etc.)
48
length()
gets the length of vectors or lists
49
levels()
allows us to assign (or see) levels to a variable. levels(x) = c("low", "high")
50
library()
51
lines()
52
list()
creates a list of things (string, numbers, etc.)
53
ln()
finds the natural log of smt
53
lm()
54
log()
find the natural log of smth
55
log10()
find base 10 logarithm of smth
56
ls()
see list of all objects in workspace
57
matrix()
creates a matrix. matrix(data, nrow = 1, ncol = 1, byrow = TRUE)
58
mean()
mean
59
median()
median
60
merge()
merges dataframes or columns merge( x, y, by = x)
61
mosaicplot()
62
N()
62
ms()
turns character or numeric vectors into object with numbers of minutes and seconds
62
mtext()
allows to write text in the margins of a plot mtext(text, side=3, line =0)
63
n()
gives the number of observations in a group
64
na.omit()
allows us to omit missing values in objects na.omit(object)
65
names()
gives the names of an object
65
nchar()
counts the number of characters
66
par()
sets graphical parameters. par(mfrow = c(1,2))
66
paste0()
67
paste()
Takes multiple elements from multiple vectors and concatenates them into one element. paste(1, 2, 3, sep = "and")
68
plot()
generic function for plotting objects plot(x, y) * y optional if x appropriate structure
69
points()
70
Points()
71
qq_Plot()
72
punctuation()
72
print()
73
qqnorm()
74
qqline()
74
qqPlot()
creates a normal quantile plot based on a data set
75
quantile()
76
read.csv()
76
range()
76
rbinom()
77
read.data()
78
rexp()
78
rep()
79
return()
80
rnorm()
80
rownames()
81
rm()
82
round()
83
sample()
83
seq()
84
runif()
85
sd()
86
setwd()
87
set.seed()
88
sort()
89
str()
90
sqrt()
91
subset()
92
substr()
93
summary()
93
t.test()
94
sum()
95
t()
96
table()
97
text()
98
tail()
99
tolower()
100
toTitleCase()
101
unique()
101
trimws()
102
var()
103
which()
104
write.csv()