I have a dataframe listing 400 Products. Each of these Products belong to a certain category: BODY CLEANSING, HAIR, DEO, HAND BODY, FACE, MEN, LIP, SUN and FEMALE SHAVE. Furthermore I have the Sales Month, in which each of the 400 Products were launched.
I want to create a new column in my dataframe displaying "TURE" if the product was launched in high season and FALSE if not.
The logic is something like this: If a product in the cateogry BODY CLEANSING or HAIR or DEO or HAND BODY or FACE or MEN or LIP was launched in the months of October or November or December high season = TRUE and if a product in the category SUN or FEMALE SHAVE is launched in the months of either April, May, June or July high season = TRUE.
I have tried the following:
Sample_15$high_season <- (Sample_15$Category == "BODY CLEANSING" | "HAIR"
| "DEO" | "HAND BODY"| "FACE" | "MEN" | "LIP" & Sample_15$Months_extract
== "Oktober" | "November" | "Dezember") | (Sample_15$Category == "SUN" |
"FEMALE SHAVE" & Sample_15$Months_extract == "April" |
"Mai" | "Juni" | "Juli")
And I get this Error message:
Error in Sample_15$Category == "BODY CLEANSING" | "HAIR" :
operations are possible only for numeric, logical or complex types
Does anybody know how to code the logic of the Boolean? Any help is appreciated!!!!
Aucun commentaire:
Enregistrer un commentaire