Data Stucture: Data Frame
Note 1. Creating a Data Frame:
Note 2. Filtering Rows Based on Condition:
Note 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
Note 4. Updating a Column’s Values:
Note 5. Calculating Summary Statistics:
Calculate the mean and median Salary
of employees using basic R functions.
Solution:
Note 6. Removing Rows Based on Condition:
Note 7. Renaming Columns:
Note 8. Selecting Specific Rows and Columns:
Select only the Name
and Salary
columns of employees who belong to the “Finance” department.
Note 9. Sorting the Data Frame:
Note 10. Finding Maximum and Minimum Values:
Identify the employee with the highest Salary
and display their Name
and Department
.