Publications by Joey Campbell

mutatejoin31_demo

14.03.2020

suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 suppressPackageStartupMessages(library("nycflights13")) package 㤼㸱nycflights13㤼㸲 was built under R version 3.6.3 suppressPackageStartupMessages(library("viridis")) package 㤼㸱viridis㤼㸲 was built under R version 3.6.2 f...

11028 sym R (3231 sym/16 pcs) 6 img

nycflights13_29_demo

13.03.2020

suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 suppressPackageStartupMessages(library("nycflights13")) package 㤼㸱nycflights13㤼㸲 was built under R version 3.6.3 1. Imagine you wanted to draw (approximately) the route each plane flies from its origin to its destination. Wh...

145417 sym R (935 sym/7 pcs) 2 img

missing27_demo

13.03.2020

1. Compare and contrast the fill arguments to spread() and complete(). In spread(), the fill argument explicitly sets the value to replace NAs. In complete(), the fill argument also sets a value to replace NAs but it is named list, allowing for different values for different variables. Also, both cases replace both implicit and explicit missing v...

1511 sym

sepuni26_demo

13.03.2020

suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 1. What do the extra and fill arguments do in separate()? Experiment with the various options for the following two toy datasets. tibble(x = c("a,b,c", "d,e,f,g", "h,i,j")) %>% separate(x, c("one", "two", "three")) Expected 3 pie...

8326 sym R (1859 sym/20 pcs)

pivoting25_demo

13.03.2020

suppressPackageStartupMessages(library("tidyverse")) 1. Why are pivot_longer() and pivot_wider() not perfectly symmetrical? Carefully consider the following example: stocks <- tibble( year = c(2015, 2015, 2016, 2016), half = c( 1, 2, 1, 2), return = c(1.88, 0.59, 0.92, 0.17) ) stocks %>% pivot_wider(names_from = yea...

16250 sym R (2919 sym/21 pcs)

tidydata24_demo

13.03.2020

suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 1. Using prose, describe how the variables and observations are organized in each of the sample tables. In table table1, each row represents a (country, year) combination. The columns cases and population contain the values for thos...

8946 sym R (1232 sym/12 pcs) 1 img

parsevec23_demo

12.03.2020

suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 1. What are the most important arguments to locale()? The locale object has arguments to set the following: date and time formats: date_names, date_format, and time_format time zone: tz numbers: `decimal_mark, grouping_mark encodin...

11910 sym R (2421 sym/34 pcs)

readr21_demo

12.03.2020

library("tidyverse") 1. What function would you use to read a file where fields were separated with “|”? Use the read_delim() function with the argument delim="|". read_delim(file, delim = "|") 2. Apart from file, skip, and comment, what other arguments do read_csv() and read_tsv() have in common? They have the following arguments in common...

6941 sym R (1189 sym/17 pcs)

tibbles21_demo

12.03.2020

suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 1. How can you tell if an object is a tibble? (Hint: try printing mtcars, which is a regular data frame). When we print mtcars, it prints all the columns. mtcars But when we first convert mtcars to a tibble using as_tibble(), it pr...

8874 sym R (1436 sym/40 pcs) 1 img

twocontvars20_demo

12.03.2020

suppressPackageStartupMessages(library("tidyverse")) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 suppressPackageStartupMessages(library("viridis")) package 㤼㸱viridis㤼㸲 was built under R version 3.6.2 1. Instead of summarizing the conditional distribution with a box plot, you could use a frequency polygon. What do you ne...

9781 sym R (1233 sym/12 pcs) 8 img