You have a dataset from which you want to extract a subset. For example, for a data consisting of employee details,

DWQA QuestionsCategory: R LanguageYou have a dataset from which you want to extract a subset. For example, for a data consisting of employee details,
Editor Staff asked 9 months ago

You have a dataset from which you want to extract a subset. For example, for a data
consisting of employee details, you want to create a subset of employees who are above 30 years
and who make salary less than 10,000. How will you execute this in R?

2 Answers
Editor Staff answered 9 months ago

The salary dataframe be
denoted by the variable ‘age’ and the data is contained within the variable ‘employee_data’.
To create a subset of employees older than 30, we will make use of the filter() function as
follows –
filter(employee_data, age >30 1, salary < 10000)

Editor Staff answered 9 months ago

The salary dataframe be
denoted by the variable ‘age’ and the data is contained within the variable ‘employee_data’.
To create a subset of employees older than 30, we will make use of the filter() function as
follows –
filter(employee_data, age >30 1, salary < 10000)