Data Stucture: Data Frame
1. Creating a Data Frame:
2. Filtering Rows Based on Condition:
3. Adding a New Column:
Add a new column to the employees
data frame named Experience
, where values are “Senior” if Age
is above 35 and “Junior” otherwise.
Hint: use ifelse() function
4. Updating a Column’s Values:
5. Calculating Summary Statistics:
Calculate the mean and median Salary
of employees using basic R functions.
Solution:
6. Removing Rows Based on Condition:
7. Renaming Columns:
8. Selecting Specific Rows and Columns:
Select only the Name
and Salary
columns of employees who belong to the “Finance” department.
9. Sorting the Data Frame:
10. Finding Maximum and Minimum Values:
Identify the employee with the highest Salary
and display their Name
and Department
.