Publications by Joey Campbell
simplemod54_demo
suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 suppressPackageStartupMessages(library("modelr")) package 㤼㸱modelr㤼㸲 was built under R version 3.6.3 The option na.action determines how missing values are handled. It is a function. na.warn sets it so that there is a warning...
9119 sym R (2276 sym/28 pcs) 4 img
otherpatterns_forloops63_demo
suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 1. Implement your own version of every() using a for loop. Compare it with purrr::every(). What does purrr’s version do that your version doesn’t? # Use ... to pass arguments to the function every2 <- function(.x, .p, ...) { ...
4635 sym R (1219 sym/22 pcs)
map_functions62_demo
suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 suppressPackageStartupMessages(library("stringr")) #The package microbenchmark is used for timing code. suppressPackageStartupMessages(library("microbenchmark")) package 㤼㸱microbenchmark㤼㸲 was built under R version 3.6.3 1...
12828 sym R (5548 sym/43 pcs)
forloops59_demo
suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 suppressPackageStartupMessages(library("stringr")) #The package microbenchmark is used for timing code. suppressPackageStartupMessages(library("microbenchmark")) package 㤼㸱microbenchmark㤼㸲 was built under R version 3.6.3 1...
14981 sym R (9370 sym/39 pcs)
augmented_vectors58_demo
suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 1. What does hms::hms(3600) return? How does it print? What primitive type is the augmented vector built on top of? What attributes does it use? x <- hms::hms(3600) class(x) [1] "hms" "difftime" x 01:00:00 hms::hms returns an ...
4114 sym R (491 sym/13 pcs)
lists57_demo
suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 1. Draw the following lists as nested sets: list(a, b, list(c, d), list(e, f)) list(list(list(list(list(list(a)))))) There are a variety of ways to draw these graphs. You could use various diagramming, drawing, or presentation soft...
1128238 sym R (167 sym/7 pcs) 2 img
using_atomic_vecs56_demo
suppressPackageStartupMessages(library("tidyverse")) 1. What does mean(is.na(x)) tell you about a vector x? What about `sum(!is.finite(x))? I’ll use the numeric vector x to compare the behaviors of is.na() and is.finite(). It contains numbers (-1, 0, 1) as well as all the special numeric values: infinity (Inf), missing (NA), and not-a-number (...
21449 sym R (2506 sym/88 pcs)
atomic55_demo
suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 1. Describe the difference between is.finite(x) and !is.infinite(x). To find out, try the functions on a numeric vector that includes at least one number and the four special values (NA, NaN, Inf, -Inf). x <- c(0, NA, NaN, Inf, -Inf...
22906 sym R (5748 sym/57 pcs) 1 tbl
func_args54_demo
suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 1. What does commas(letters, collapse = "-") do? Why? The commas() function in the chapter is defined as commas <- function(...) { str_c(..., collapse = ", ") } When commas() is given a collapse argument, it throws an error. com...
6317 sym R (1338 sym/16 pcs)
conditional_execution53_demo
suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 suppressPackageStartupMessages(library("lubridate")) 1. What’s the difference between if and ifelse()? Carefully read the help and construct three examples that illustrate the key differences. The keyword if tests a single conditi...
15338 sym R (3860 sym/60 pcs)