getting error wile trying to satisfy both the conditions

Process the data as follow:

. Select the ad that satisfy both conditions:
1.Both the expert gave 5,6 or 7 in Story,Completeness,Character
2.Both the expert gave 4,5,6 in Excitement,Action,Climax,Release

  • From the filtered set of ads, find the average of the expert rating for each ad.

data<- data.frame(Advertisement=c("Ad_1","Ad_1","Ad_2","Ad_2","Ad_3","Ad_3","Ad_4","Ad_4","Ad_5","Ad_5"),
                  Expert=c(1,2,1,2,1,2,1,2,1,2),Story=c(5,5,5,3,6,5,5,5,5,7),Completeness=c(6,7,7,4,5,7,5,5,5,4),
                  Character=c(6,7,6,6,5,5,5,7,7,2),Excitement=c(5,5,6,4,4,5,6,6,5,6),Action=c(5,6,4,5,6,5,5,6,5,5),
                  Climax=c(6,5,6,4,4,4,5,6,6,4),Release=c(6,4,5,6,5,6,4,6,6,4))
df_data1<-data %>% filter((Expert==1&Story>=5&Completeness>=5&Character>=5&Excitement>=4&Action>=4&Climax>=4
                           & Release>=4)&(Expert==2&Story>=5&Completeness>=5&Character>=5 &Excitement>=4&Action>=4&Climax>=4& Release>=4))

Hi, welcome!

Please have a look to our homework policy, homework inspired questions are welcome but they should not include verbatim instructions from your course.

There are no rows with Expert == 1 and Expert == 2, so your filter returns zero rows.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.