Home > OS >  Is there something wrong with this Filter function code in R?
Is there something wrong with this Filter function code in R?

Time:07-19

I am trying to filer the "ToothGrowth" dataset by "dose" of the "supp" in R but I am receiving the below mentioned error.

CODE:

install.packages("dplyr")
data("ToothGrowth")
View(ToothGrowth)
filtered_tg <- filter(ToothGrowth, dose==0.5)
View (filtered_tg)

ERROR:

Error in filter(ToothGrowth, dose == 0.5) : object 'dose' not found View (filtered_tg)

enter image description here

CodePudding user response:

You need library(dplyr) after install.packages("dplyr").

  •  Tags:  
  • r
  • Related