1 of 32

1

THE ‘R’

MURDER MYSTERY

2 of 32

2

intro/murder_mystery.R

3 of 32

3

A crime has taken place and the detective needs your help. The detective gave you the crime scene report, but you somehow lost it. You vaguely remember that the crime was a murder that occurred sometime on January 15, 2018 and that it took place in SQL City.

All the clues to this mystery are buried in a huge database, and you need to use your R skills to navigate through this vast network of information. Your first step to solving the mystery is to retrieve the corresponding crime scene report from the police department’s database.

4 of 32

4

data model

5 of 32

5

person

drivers_license

income

get_fit_now_member

interview

get_fit_now_check_in

facebook_event_checkin

6 of 32

6

person

crime_scene_report

drivers_license

income

get_fit_now_member

interview

get_fit_now_check_in

facebook_event_checkin

7 of 32

submit the name of the murderer and attach your .R-script:�

n.meseth@hs-osnabrueck.de

8 of 32

8

Congrats, you found the murderer! But wait, there's more... If you think you're up for a challenge, try querying the interview transcript of the murderer to find the real villain behind this crime.

9 of 32

debriefing

10 of 32

colnames()

11 of 32

the pipe operator |>

12 of 32

filter()

13 of 32

13

filter()

A

B

C

A

B

C

14 of 32

select()

15 of 32

15

select()

A

B

C

A

16 of 32

pull()

17 of 32

arrange()

18 of 32

18

arrange()

A

B

3

1

2

Z

X

Y

A

B

1

2

3

X

Y

Z

19 of 32

str_starts()

str_ends()

str_detect()

20 of 32

“Annabel Miller”

21 of 32

Annabel Miller”

str_starts(txt, "Anna")

22 of 32

“Annabel Miller

str_ends(txt, "Miller")

23 of 32

“Annabel Miller”

str_detect(txt, "Mill")

24 of 32

%in% with c()

25 of 32

distinct()

26 of 32

between()

27 of 32

left_join()

28 of 32

ID

A

1

2

3

X

Y

Z

ID

B

1

2

4

T

F

T

ID

A

1

2

3

X

Y

Z

B

T

F

NA

29 of 32

inner_join()

30 of 32

ID

A

1

2

3

X

Y

Z

ID

B

1

2

4

T

F

T

ID

A

1

2

X

Y

B

T

F

31 of 32

full_join()

32 of 32

ID

A

1

2

3

X

Y

Z

ID

B

1

2

4

T

F

T

ID

A

1

2

3

X

Y

Z

B

T

F

NA

NA

4

T