Explain dplyr() library along with installation in R.
dplyr() is used to provide much better flexibility in R regarding data manipulation and other operations.dplyr aims to provide following operations
filter()- It is used to select subset of rows based on conditions passed
arrange()- It is used in ordering sequence or rows based on the condition passed.
select()- It is used to select any specific variables based on the names of them.
sample_n()- it is used to take some sample of a dataset by selecting the number of variables in a random manner.
rename()- it is used to rename the variable names whenever required
To install dplyr library in R, we can use
install.packages(“dplyr”)
To read the library dplyr, we can use
library(dplyr)
From mtcars dataset let us select the information based on the following condition
Return rows of cars that have an mpg value greater than 20 and 6 cylinders.
filter(mtcars,mpg>20,cyl==6)
We will get the following output based on the condition passed.