-
Notifications
You must be signed in to change notification settings - Fork 637
/
exercise.R
56 lines (22 loc) · 1.29 KB
/
exercise.R
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
# Create a vector of 100 employees ("Employee 1", "Employee 2", ... "Employee 100)
# Create a vector of 2014 salaries using the runif function
# Create a vector of 2015 salaries that are typically higher than the 2014 salaires (use runif again)
# Create a data.frame 'salaries' by combining the vectors you just made
# Create a column 'raise' that stores the size of the raise between 2014 and 2015
# Create a column 'got.raise' that is TRUE if the person got a raise
# Retrieve values from your data frame to answer the following questions:
# What was the 2015 salary of employee 57
# How many employees got a raise?
# What was the value of the highest raise?
# What was the name of the employee who recieved the highest raise?
# What was the largest decrease in salaries between the two years?
# What was the name of the employee who recieved largest decrease in salary?
# What was the average salary increase?
### Bonus ###
# Write a .csv file of your salaries to your working directory
# For people who did not get a raise, how much money did they lose?
# Is that what you expected them to lose?
### Double Bonus (no answer given) ###
# Repeat the above experiment 100 times, tracking the loss each time.
# Does the average loss equal what you expect?
# What about 10,000 times?