mercredi 15 janvier 2020

R: t.test, if certain criteria are met

the question is enterirely hypothetical, as I don't have the data yet, but am working on a statistical plan for later. Thank you in advance!

I would like to compare 2 groups with a t.test. My problem is, that I would like to have certain criteria met. The data will have a numerical variable and 2 factors with 2 levels.

Example: antibody levels measured in animals, which were either "bottle fed" or "tubed" (factor A) and which receive or don't receive a treatment (factor B). I would like to compare the antibody levels of "bottle fed" or "tubed" animals (factor A can be 0 or 1), which receive treatment X (factor B must be 1). Does that make sense?

t.test(antibody~factorA) ... if_else? I tried ifelse and if_else of the dplyr package, but it doesn't work. Is there a way around creating a new table? Rebecca

Aucun commentaire:

Enregistrer un commentaire