can give you numbers greater or less than a certain number
Ex: data= c(1,2,3,4,5,6)
which(data < 5)
=4,3,2,1
Back
sample()
Front
takes a sample of the specified size from the elements of x, either with or without replacement.
Ex: sample(x, size=n, replace=FALSE, prob=c())
Back
mean
Front
average
Back
length(c(1,2,3))
Front
# of elements
Back
runif()
Front
produces x number of values between a min and a max
Ex: runif(5, min=1, max=5)
Back
dataAfterRemoval
Front
removes data
ex: dataAfterRemoval= data[(data>=2) & (data<=5)]
Back
paste
Front
paste( "animal", "foot", "butterfly", sep("-"))
Back
any
Front
asking if there are any true values in x
Back
v7=rep(c(1,2,3), times=3)
Front
repeat vector 3 times
Back
min
Front
smallest number in vector
Back
sort(data,decreasing=TRUE)
Front
sort data decreasing from biggest to smallest
Back
sum(c(1,2,3))
Front
sum of the included numbers
Back
v=seq(from=1, to=9, by=2s)
Front
1 to 9 by 2s
Back
MIN
Front
the excel function that calculates the smallest value in a range of cells
Back
sqrt(data)
Front
square root of data
Back
seq
Front
creates a sequence of numbers
seq(from=1, to=5, length=6)
Back
SQRT
Front
the Excel function that calculates the square root
Back
COUNT
Front
counts the number of cells that contain numbers
Back
sample
Front
Back
?seq
Front
pulls up help on sequence function
Back
data(rivers)
Front
pulls data on rivers
Back
SUMSQ
Front
squares and then sums the values together
Back
v=c(1,2,3,4)
Front
vector
Back
SUMPRODUCT
Front
excel function for multiplying numbers together and then adding them
Back
prod(c(1,2,3))
Front
product of the included numbers
Back
V[4]
Front
what is the fourth element of vector v
Back
AVERAGE
Front
the Excel function that calculates the average value in a range of cells
Back
all
Front
Back
v8=rep(c(1,2,3), each=4)
Front
repeat each number in the vector individually 4 times
Back
MAX
Front
the Excel function that calculates the largest value in a range of cells
Back
max
Front
biggest numbering vector
Back
paste0
Front
same as paste but no spaces
Back
How to count the number of x in a vector
Front
countx=length(which(v==x))
countx
Back
char
Front
number of characters that make up a string of text
Back
rep
Front
repeat numbers in vector
times= repeat the numbers x amount of times (1,2,3,1,2,3)
each= repeat the numbers x amount of times individually (1,1,1,2,2,2,3,3,3)
Back
SUM
Front
the Excel function that calculates the sum
Back
choose(6,2)
Front
combination
Back
replicate()
Front
is a function that allows us to repeatedly evaluate an expression (which usually involves something being done "randomly", like the selection of a sample()).
> replicate(n=20, sum(sample(1:6, size=2, replace=TRUE))) [1] 8 9 6 9 8 7 11 5 7 5 11 7 7 12 8 12 6 10 6 10