0

I have to run a t-test and need to remove the group of people that responded with "no answer" which generated a third, 99 group. I keep getting an error message saying the grouping factor needs to have exactly two groups. And I want to keep groups 1 and 2. Here is an example of the type of result I am looking for:

below is the table result

I've tried the select and keeps functions but they either do not work or don't do what i want.

FollowPoliticians <- as.factor(dataset$Q18)
SatisfactionDemocracy <- as.numeric(dataset$Q27)

table(FollowPoliticians)

psych::describeBy(SatisfactionDemocracy, FollowPoliticians)
Dataframe <- data.frame(SatisfactionDemocracy, FollowPoliticians)

could anybody help me?

OTStats
  • 1,820
  • 1
  • 13
  • 22
begoniath
  • 11
  • 1
  • You have to re-build the factor after removing the "No Answer" category since the empty category remains after you remove all of the observations that have "No Answer". Don't forget to remove the matching observations in StatisfactionDemocracy as well. I don't see the code where you removed the `99` observations. – dcarlson Jul 16 '20 at 15:53
  • @begoniath please create a minimal example. https://stackoverflow.com/help/minimal-reproducible-example – simar Jul 17 '20 at 02:42

0 Answers0