In using the QCA package, we usually employ ifelse to replace dataset columns with dichotomized values. But I find it ugly to have to use nested ifelses when dealing with fuzzy sets.
Is there a way to use a case statement instead? switch is only for control flow, and does not deal with vectors.
For example:
DDDfz $VIES <- ifelse (DDD $vies == "p", 1, 0)
is OK, but
DDDfz $TIPO <- switch (DDD $tipo, "PD", 0, "PL", 0.5, "MP", 1)
Error in switch(DDD$tipo, "PD", 0, "PL", 0.5, "MP", 1) :
EXPR deve ser um vetor de comprimento 1
Aucun commentaire:
Enregistrer un commentaire