1/43
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
FRONT
BACK
How would you code the format function for a date or a POSIXct?
format(date/datetime, format = “”)
FIRST PASS
FIRST PASS
SECOND PASS
SECOND PASS
What function allows you to look at your loaded packages?
search()
What function returns a boolean vector for elements that meet a certain pattern in a dataset? What are its basic arguments?
grepl()
grepl(pattern = “string“, x = dataset)
What function allows you to exchange a part of elements in a dataset that matches a particular pattern with specified data? What are it’s basic arguments?
sub()
sub(pattern = ““, replacement = ““, x = dataset)
What function allows you to exchange multiple parts of elements in a dataset that match a particular pattern with specified data? What are it’s basic arguments?
gsub()
gsub(pattern = ““, replacement = ““, x = dataset)
What function applies another function of your choosing to a set of variables and then returns a result with the format of your choosing?
vapply()
What function tells you the date?
Sys.Date()
What function allows you to install a package?
install.packages()
What two functions allow you to load a package, and what is the main difference between them?
library() and require()
library() throws an error whereas require() gives a warning
What function allows you to create a series of numbers with a pattern, that ranges from one number to another number? What are the basic arguments for this function?
seq()
seq(num1, num2, by = numRule)
What function repeats specified code execution a specified number of times? What are the basic arguments for this function?
rep()
rep(code, times = num)
There is a similar set of functions for checking if your variable is the desired data type. What is the version of this function for a list?
is.list()
There is a similar set of functions for creating a temporary conversion of your variable to the desired data type. What is the version of this function for a list?
as.list
What function returns a vector of indices for elements that meet a certain pattern in a dataset? What are its basic arguments?
grep()
grep(pattern = “string“, x = dataset
Which function returns the TRUE indices for a boolean vector?
which()
What function gives you the date and time?
Sys.time()
What is the basic template for coding your own functions?
name <- function(argnames) {
}
What is the .GlobalEnv package?
User defined objects and functions
What function applies another function of your choosing to a set of variables?
lapply()
What function converts a list to a vector?
unlist()
What is the basic template for coding an anonymous function?
function(x) { code }
Can you use $ for vectors?
No
What function applies another function of your choosing to a set of variables and then simplifies the result?
sapply()
What function checks if two things are exactly the same?
identical()
Can you have functions without braces?
Yes, if there is only one line of code
What’s the difference between the order and the sort function?
Both sort low to high, order returns the placement of those values in the original array whereas sort returns the actual values
What function strips away the the class of a variable, leaving only the raw data?
unclass()
What are the object types of dates and datetimes? Also, what does the datetime acronym stand for?
Dates: Date
Datetimes: POSIXct
Portable Operating System Interface Calendar Time
What is the function for creating and possibly printing a differently formatted version of a date or datetime?
format()
What function gives you documentation for a function? What code gives you documentation for a function?
help()
or
?functionname
What function tells you the default arguments of another function?
args()
What function is used to have your function return a value?
return()
What will a function return if you don’t use the return function?
The last expression evaluated in the function
Is null lowercase or caps?
Caps
What happens when you tell vapply() to return one format, but it receives incompatible data?
vapply() throws an error
What function reverses elements in an object?
rev()
What’s the easiest way to combine two vectors?
c(v1, v2)
What happens if you add a number to a date?
The date increases by that number of days
What happens if you subtract one date from another date?
You get the number of days between the two dates
If dates are measured in days, what are date and times measured in?
Seconds
What function generates a vector of the differences between adjacent elements in a numerical vector?
diff()