I'm doing a study assignment. I have a small data set:
Last_name <- c("Lyons","Wilkinson","Chambers","Thornton","Holland")
Salary_dollars <- c(2285, 2351, 3654, 2121, 3098)
Work_experience_months <- c(24, 17, 72, 12, 44)
df <- data.frame(Last_name, Salary_dollars, Work_experience_months)
print(df)
Last_name Salary_dollars Work_experience_months
1 Lyons 2285 24
2 Wilkinson 2351 17
3 Chambers 3654 72
4 Thornton 2121 12
5 Holland 3098 44
I can display information separately, that is, about the worker with the highest salary and the worker with the least experience.
Factory_workers[which.max(Factory_workers$Salary_dollars),]
Factory_workers[which.min(Factory_workers$Work_experience_months),]
How can I arrange this request so that these two conditions are in one request? I need to display information about the worker with the highest salary and the least experience.
Update, full text of the assignment:
Information about five workers of the shop is given.
The columns have names: last name, salary, work experience.
Display data about the worker with the
highest salary and the least length of service.
it seems to me that a relative connection of these two indicators is needed here and the output should be one line.