Repository navigation
Expand file tree
/
Copy pathModule_2.Rmd
More file actions
1645 lines (983 loc) · 54.2 KB
/
Copy pathModule_2.Rmd
File metadata and controls
1645 lines (983 loc) · 54.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Module 2"
description: |
This module is a re-introduction to Excel.
output:
distill::distill_article:
toc: true
toc_depth: 2
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
# Excel
{width="40%"}
I may trash talk excel 😈, but I would argue that it is the most used tool for accountants. Accountants are the **original** data scientists[^1] and their weapon of choice has been excel. A large portion of this class will be using R, **BUT** I hope to show you that R and Excel can work together. At the very least you will learn how to do everything we see in this module in R and you can decide which tool you want to use. 😏 This case study is provided by [PWC](https://www.pwc.com/us/en/careers/university-relations/data-and-analytics-case-studies.html). It was developed for a [masters level course](https://www.pwc.com/us/en/careers/university-relations/data-and-analytics-case-studies.html), but I am adapting it for our class. This should be a **Review** and I plan to move through this quickly. But, as always, you can slow me down with questions and comments.
[^1]: in my opinion 😄
# Module Objectives
- Demonstrate knowledge of data quality concepts
- Demonstrate knowledge of key terms and capabilities in Excel
- Demonstrate how to use Excel to acquire, transform, analyze, and visualize data
- Demonstrate knowledge of leading practices for presenting findings in Excel
## Why excel?
::: {style="display: grid; grid-template-columns: 1fr 1fr; grid-column-gap: 15px;"}
<div>
- We have no choice... everybody uses it! - this is the hard [**truth**]{.ul}
- Easy-to-use \<- debatable 😅
- Many different functions
</div>
<div>
{width="40%"}
</div>
:::
- Advanced capabilities through add-ins
- Easy to explore and manipulate the data
- Can present data and analysis together
- Integrated with common desktop applications
***But...***
- Significant potential for human error
- Limited scalability
***Keep it simple and ask the Internet!***
### Key terms
+----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| $\color{red}{\text{Term}}$ | $\color{red}{\text{Definition}}$ |
+============================+==============================================================================================================================================================+
| **Workbook** | An Excel file is referred to as a workbook |
+----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Worksheet** | A single "tab" or "sheet" within a Workbook |
+----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Cell** | The boxes within the worksheet where information is stored. Cells are referenced by column letters (A, B, C, ...) and row numbers (1, 2, 3, ...) like a map: |
+----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| | - $\color{red}{\text{A1}}$ |
| | - $\color{red}{\text{BX800}}$ |
| | - $\color{red}{\text{EEE20}}$ |
+----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Range** | A contiguous set of cells referenced by the top left and bottom right cells, separated by a colon (:): |
+----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| | - $\color{red}{\text{A1:D23}}$ |
| | - $\color{red}{\text{BA2:CT8}}$ |
+----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
## Cell References
- Excel formulas can reference different cells
- Changes to the referenced cells result in updates to value calculated by the formula
{width="100%"}
#### Inputs within functions can be either a single cell reference or a block of cells referred to as a range.
The two example below provide the same result:
+--------------------+--------------------------------------------------------+------------------------------------------+
| **=SUM(C1,C2,C3)** | **Single cells selection-** | |
| | | |
| | $\color{red}{\text{Use the Ctrl Key}}$ | |
+====================+========================================================+==========================================+
| **=SUM(C1:C3)** | **Range selection-** | {width="100%"} |
| | | |
| | $\color{red}{\text{use Shift Key or Drag with mouse}}$ | |
+--------------------+--------------------------------------------------------+------------------------------------------+
Note: should a row be inserted between C1 and C3, then example 1 will still provide the same results, however example two will extend to add 4 cells.
#### Absolute cell references
Absolute referencing is a way of referring to cells within formulas so that once copied, the cell reference remains fixed to a particular cell
+----------------------------------------------+--------------------------------------------------------------------------------+
| {width="100%"} | **Relative referencing** |
| | |
| | As a formula is copied along, the row/column numbers adjust accordingly |
+----------------------------------------------+--------------------------------------------------------------------------------+
| {width="100%"} | **Absolute referencing** |
| | |
| | As a formula is copied along, it continues to refer to the same cell as before |
+----------------------------------------------+--------------------------------------------------------------------------------+
#### Absolute cell referencing
With absolute cell referencing, a dollar sign (\$) appears in the cell reference:
- =B4 Refers to column B and row 4,
But this will vary if the formula is copied across a range of cells $\color{red}{\text{(relative reference)}}$
- =\$B4 Will always refer to column B, but row reference can vary
- =B\$4 Will always refer to row 4, but column reference can vary
- =\$B\$4 Will always refer to column B and row 4
$\color{red}{\text{(absolute reference)}}$
Keyboard shortcut F4 cycles through the four absolute cell reference options
## Formulas
- Excel calculations are specified with formulas in each cell
- To create a formula, type an equals sign (=) followed by the function and required arguments
[Order of Operations]{.ul}
::: {style="display: grid; grid-template-columns: 1fr 1fr; grid-column-gap: 5px;"}
<div>
+-------------------------+------------------+
| Brackets | ( ) |
+-------------------------+------------------+
| Exponent | \^ |
+-------------------------+------------------+
| Division/Multiplication | / \* |
+-------------------------+------------------+
| Addition/Subtraction | \+ - |
+-------------------------+------------------+
</div>
<div>
{width="60%"}
</div>
:::
## Functions
The fx button to the left of the formula bar opens a list of all available functions
{width="100%"}
#### Arguments
Functions take zero or more inputs or arguments
=FUNCTION(Input1,Input2,...)
Arguments can be:
| | |
|-----------------|----------------------------------------------------------|
| Values | 1, 2, 3 or 1.2, 3.6, 2.1 or "x", "y", "z" or TRUE, FALSE |
| Cell References | B91, A452, C3 |
{width="100%"}
## Navigation shortcuts (Windows)
+-----------------------------+------------------------------------------------------------------+
| Ctrl + ➡️(⬅️,⬆️,⬇️) | navigate to the last non-empty cell in that direction |
+-----------------------------+------------------------------------------------------------------+
| Ctrl + Shift + ➡️(⬅️,⬆️,⬇️) | select a block of cells to last non-empty cell in that direction |
+-----------------------------+------------------------------------------------------------------+
| Ctrl + Space | select the entire column of the cell you have selected |
+-----------------------------+------------------------------------------------------------------+
| Shift + Space | select the entire row of the cell you have selected |
+-----------------------------+------------------------------------------------------------------+
# Acquire data
## Getting data into excel
- Excel files have the extension .xlsx or .xls (older versions)
- Excel can also import data from delimited text files
- Some comma-separated values files can be opened directly by Excel
- Tab-separated values can be copy-and-pasted directly into an Excel worksheet
- Delimited text can also be copy-and-pasted into Excel and then separated with text-to-columns
{width="100%"}
#### Example - Delimited text
{width="100%"}
## Text to columns
- You might have text in one column that should be split across multiple columns, such as "1-Q-Fred" in the example below
- You can use the "Text to Columns" wizard to accomplish this
{width="100%"}
- Follow the steps prompted when clicking the icon in the Data tab. You can specify:
- Whether the separation point is defined by a certain character (Delimited) or at a fixed point in the cell (Fixed Width).
- What character separates the information
- Where you would like the newly separated information to go.
## References to worksheets and workbooks
- You can also use data from other worksheets or other workbooks in your formulas
- Another worksheet in the same workbook is represented by "Sheet!"
- A worksheet in a different workbook is represented by "[Workbook.xlsx]Sheet!"
{width="100%"}
#### Sample spreadsheet
{width="100%"}
## Sorting
- Highlight a range and use the Sort option to order records by one or more columns
- Make sure to select an entire table to avoid sorting only part of it
{width="100%"}
## Filters
- Filtering allows you to hide rows in a range if they don't match select criteria
- Highlight the range and click the "Filter" button
{width="100%"}
### Custom filters
Custom filters allow you to use multiple criteria such as AND or OR
- Click on drop down arrow
- Click "Text Filters"
- Choose Custom
{width="100%"}
# Summary statistics
::: {style="display: grid; grid-template-columns: 1fr 1fr; grid-column-gap: 10px;"}
<div>
**COUNT() -** Counts numbers
**COUNTBLANK() -** Counts empty cells
**COUNTA() -** Counts non-empty cells
**MIN() -** Returns minimum
**MAX()** **-** Returns maximum
**AVERAGE()** **-** Returns average/mean
**ROWS/COLUMNS() -** Return number of rows/columns
</div>
<div>
{width="100%"}
</div>
:::
## Status Bar
- Highlighting a range of cells returns summary statistics on the status bar in the lower right corner
- This is a quick way to get information about part of your data
{width="100%"}
# Can we rely on the data?
{width="100%"}
## Data quality dimensions
{width="100%"}
### Exercise - Data quality dimensions
Identify which of the six DQ dimensions applies to the issues described below $\color{red}{\text{(please do not peek at the answers 😈)}}$:
1. 'Gender' field has the special characters like \~!\@\#\$%\^\*();
<details>
<summary>
Answer
</summary>
<p>
```{r DQ_Exercise_1_1_A, echo=FALSE}
print("Validity")
```
</p>
</details>
2. 'First name' is blank or Null
<details>
<summary>
Answer
</summary>
<p>
```{r DQ_Exercise_1_2_A, echo=FALSE}
print("Completeness")
```
</p>
</details>
3. 'Last name' field has only designators such as LLP, LLC, Mr., Mrs., etc
<details>
<summary>
Answer
</summary>
<p>
```{r DQ_Exercise_1_3_A, echo=FALSE}
print("Accuracy")
```
</p>
</details>
4. 'Address' field has only numbers
<details>
<summary>
Answer
</summary>
<p>
```{r DQ_Exercise_1_4_A, echo=FALSE}
print("Validity")
```
</p>
</details>
5. 'Account Type' field does not have pre-defined list of values
<details>
<summary>
Answer
</summary>
<p>
```{r DQ_Exercise_1_5_A, echo=FALSE}
print("Consistency")
```
</p>
</details>
6. 'Account Number' field have duplicate values
<details>
<summary>
Answer
</summary>
<p>
```{r DQ_Exercise_1_6_A, echo=FALSE}
print("Integrity")
```
</p>
</details>
7. 'Forex rate' field does not have up to date exchange rate
<details>
<summary>
Answer
</summary>
<p>
```{r DQ_Exercise_1_7_A, echo=FALSE}
print("Timeliness")
```
</p>
</details>
# Exercise - Excel \#1
Load the data from 'payroll_data.txt' and 'reference_data.txt' into two tabs in an Excel spreadsheet and save it as 'Payroll Data\_\<NETID\>.xlsx' $\color{red}{\text{(please do not peek at the answers)😈}}$ :
1. How did you import the data?
<details>
<summary>
Answer
</summary>
<p>
```{r Excel_Exercise_1_1_A, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Animation.gif")
```
</p>
</details>
2. How many rows are there?
<details>
<summary>
Answer
</summary>
<p>
```{r Excel_Exercise_1_2_A, echo=FALSE}
print(c("payroll_data = 202 rows including header","reference_data = 199 rows including header"))
```
</p>
</details>
3. How many columns?
<details>
<summary>
Answer
</summary>
<p>
```{r Excel_Exercise_1_3_A, echo=FALSE}
print(c("payroll_data = 9 columns","reference_data = 3 columns*"))
```
</p>
</details>
4. What is the average salary?
<details>
<summary>
Answer
</summary>
<p>
```{r Excel_Exercise_1_4_A, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Excel_Exercise_1_4_A.png")
```
</p>
</details>
5. How many missing values are in each column?
<details>
<summary>
Answer
</summary>
<p>
```{r Excel_Exercise_1_5_A, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Excel_Exercise_1_5_A.png")
```
</p>
</details>
6. What potential data quality issues do you find? Which dimensions are they related to?
<details>
<summary>
Answer (one example)
</summary>
<p>
```{r Excel_Exercise_1_6_A, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Excel_Exercise_1_6_A.png")
```
</p>
</details>
# Transform Data
## Data formats
Data entered an Excel worksheet can be represented in different formats, for example:
- Number
- Currency
- Percentage
- Text
- Date
Dates are stored as the number of days from a fixed historical date
{width="100%"}
## Text functions
::: {style="display: grid; grid-template-columns: 1fr 1fr; grid-column-gap: 10px;"}
<div>
=CONCATENATE (text1, text2, ...) or &
: Appends two or more strings
=MID(text, start_num, num_chars)
: Extracts a specific number of characters starting from a given position
</div>
<div>
{width="100%"}
</div>
:::
=LEFT(text, num_chars)
: Extracts a specific number of characters from the left of a cell
=RIGHT(text, num_chars)
: Extracts a specific number of characters from the right of a cell
=LEN(text)
: Return the number of characters (including spaces) in a cell
=SUBSTITUTE(text, old_text, new_text)
: Replaces a string with another string
=FIND(find_text, within_text, start_position)
: Return the position of a match and error if no match
## Number functions
::: {style="display: grid; grid-template-columns: 1fr 1fr; grid-column-gap: 10px;"}
<div>
=ROUND(number, num_digits)
: Rounds a figure to a specified number of digits
=LARGE(array, k)
: Returns the kth largest number
=SMALL(array, k)
: Returns the kth smallest number
</div>
<div>
{width="100%"}
</div>
:::
=PRODUCT(number1, number2, ...)
: Multiplies several values together
=EXP(number)
: Returns Euler's number (e) raised to a number
=RAND()
: Returns a random number between 0 and 1
=RANDBETWEEN(bottom, top)
: Returns a random integer between the specified values
## Date/time functions
::: {style="display: grid; grid-template-columns: 1fr 1fr; grid-column-gap: 10px;"}
<div>
=TODAY()
: Displays current date
=NOW()
: Displays current date and time
=DATE(year, month, day)
: Generates a date given day, month, and year
</div>
<div>
{width="100%"}
</div>
:::
=DAY(serial_number)
: Determines day of date, e.g. 31
=MONTH(serial_number)
: Determines month of date, e.g. 12
=YEAR(serial_number)
: Determines year of date, e.g. 2001
=WEEKNUM(serial_number)
: Returns the week number in the year
=WEEKDAY(serial_number)
: Returns the position of the day in a workweek
=DAYS(end_date, start_date)
: Returns number of days between two dates
=NETWORKDAYS(start_date, end_date)
: Returns the number of working days between dates
## Fill
- You can apply a formula to an entire column by using the Fill options
- You can also Fill Down by double-clicking a cell with a formula in a table
{width="100%"}
## Error trapping
=ISNA(value)
: Determine if cell or result of formula is showing \#N/A!
=ISERROR(value)
: Determine if cell or result of formula is an error
=IFERROR(value, value_if_error)
: Give an alternative result if the formula produces an error
{width="100%"}
## IF statements
- **IF()** analyses the contents of one or more cells to determine whether a condition is TRUE or FALSE
- Given the value of the condition, different values can be returned
**Syntax**
=IF ( $\color{darkred}{\text{logical_test}}$ , $\color{red}{\text{value_if_true}}$ , $\color{maroon}{\text{value_if_false}}$ )
Examples
=IF ( $\color{darkred}{\text{B1 > 50}}$ , $\color{red}{\text{B1 * A1}}$, $\color{maroon}{\text{B1 * A3}}$)
=IF ( $\color{darkred}{\text{B1 > B2}}$ , $\color{red}{\text{B1}}$ , $\color{maroon}{\text{B2}}$ )
=IF ( $\color{darkred}{\text{B1 = "awesome"}}$ , $\color{red}{\text{B1}}$ , $\color{maroon}{\text{B2}}$ )
{width="100%"}
## Conditional operators
Any function can be used with conditional operators in IF statements to test conditions
\> Greater than
\< Less than
\>= Greater than and equal to
\<= Less than and equal to
\<\> Not equal to
= Equal to
## NOTE:
Some of functions can be used only on numbers, some to dates and some to strings.
- Addition: Numbers, Dates
- Subtraction: Numbers, Dates
- Multiplication: Numbers
- Division: Numbers
- Power: Numbers
- (): Anything
- Order operators (\>,\< etc.) : Numbers, Dates, Strings
- Concatenation: Anything
## Nested conditional statements
=IF ($\color{darkred}{\text{logical_test}}$ , $\color{red}{\text{value_if_true}}$ , IF ($\color{darkred}{\text{logical_test}}$ , $\color{red}{\text{value_if_true}}$ , $\color{maroon}{\text{value_if_false}}$ ))
{width="100%"}
=IF ( $\color{darkred}{\text{B1 > 50}}$ , $\color{red}{\text{B1 * A1}}$, IF ( $\color{darkred}{\text{B1 > 150}}$ , $\color{red}{\text{B1 * A2}}$, $\color{maroon}{\text{B1 * A3}}$) )
## Logical operators
=AND($\color{darkred}{\text{logical1}}$, $\color{red}{\text{logical2}}$, ...) Gives **True** if all the conditions are met
=OR($\color{darkred}{\text{logical1}}$, $\color{red}{\text{logical2}}$, ...) Gives **True** if at least one condition is met
=NOT($\color{darkred}{\text{logical}}$) Gives **True** if the condition is not met
{width="100%"}
## VLOOKUP
- Often we need to add data from one table to another. This requires one column in each table to act as the link between them
- **VLOOKUP** searches vertically down the left-hand column of a table to find a match, then returns the corresponding value from a specified column of the table
- In most cases, the fourth argument should be 'FALSE' to require exact matches
Always use absolute cell references to specify the range containing the lookup data
{width="100%"}
## Unique values and duplicates
- Excel has an option to reduce a single column to its unique values
- This option can also remove duplicate rows from a table across multiple columns
{width="100%"}
## Find/Replace
- You may need to find or replace values across a worksheet or workbook, which would be time-consuming if done manually
- Use Find/Replace to do this efficiently:
- Ctrl + F: find
- Ctrl + H: replace
- Excel will search the whole worksheet (or workbook) unless a range is selected
- The "Options \>\>" button enables the use of requirements such as "Match case"
{width="100%"}
# Exercise Excel \#2
In 'Payroll Data\_\<NETID\>.xlsx' $\color{red}{\text{(please do not peek at the answers)😈}}$ :
1. Address any data quality issues identified previously.
👍
2. Create a new column with total compensation (salary plus overtime pay)... what is the average total compensation?
<details>
<summary>
Answer
</summary>
<p>
```{r Excel_Exercise_2_2_A, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Excel_Exercise_2_2_A.gif")
```
</p>
</details>
3. Add a column for the employee's tenure at the company in years.
<details>
<summary>
Answer
</summary>
<p>
```{r Excel_Exercise_2_3_A, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Excel_Exercise_2_3_A.gif")
```
</p>
</details>
4. It turns out that all of the NJ employees work for separate division called "Tasty New Jersey". Correct the Division column with this information.
<details>
<summary>
Answer
</summary>
<p>
```{r Excel_Exercise_2_4_A, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Excel_Exercise_2_4_A.png")
```
```{r Excel_Exercise_2_4_B, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Excel_Exercise_2_4_A.gif")
```
</p>
</details>
5. Create a binary column (0/1) that identifies employees of the "Tasty" operating units.
<details>
<summary>
Answer
</summary>
<p>
```{r Excel_Exercise_2_5_A, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Excel_Exercise_2_5_A.png")
```
</p>
</details>
6. Add columns for Job Position and Gender from the 'Reference Data' worksheet.
<details>
<summary>
Answer
</summary>
<p>
```{r Excel_Exercise_2_6_A, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Excel_Exercise_2_6_A.gif")
```
</p>
</details>
7. Select a random 5% sample of employees to receive a survey.
<details>
<summary>
I had to search the web for this one
</summary>
<p>
```{r Excel_Exercise_2_7_A, echo=FALSE, out.width = '100%'}
knitr::include_graphics("images/Excel_Exercise_2_7_A.gif")
```
</p>
</details>
# Analyze data
## Pivot tables
::: {style="display: grid; grid-template-columns: 1fr 1fr; grid-column-gap: 10px;"}
<div>