Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(dplyr)
- # Example dataset
- data <- data.frame(
- Age = c(25, 45, 35, 40),
- Income = c(50000, 100000, 75000, 50000),
- Education = c(12, 16, 14, 16),
- Gender = c("Female", "Male", "Female", "Male")
- )
- # Slicing data by Gender
- data_male <- filter(data, Gender == "Male")
- data_female <- filter(data, Gender == "Female")
- # Dicing data to view Income and Education of Males
- data_male_income_education <- select(data_male, Income, Education)
- # Display the sliced and diced data
- print(data_male_income_education)
Add Comment
Please, Sign In to add comment