I have the data frame DT that includes 3 columns: Reg (Regions), Products and values. What I would like is first to loop over all prodcuts, if for one product I have two elements such as "WLD" and "EUN" within the Reg column, then I will skip this product and go to the next one.
COMS <- unique(DT$XX)
for (j in 1:length(COMS)){
CURRENT_COMS <- COMS[j]
df <- filter(DT, XX==CURRENT_COMS)
if ("WLD" && "EUN" %in% DT$Reg) {next} # Here is the problem
m_OLS_EUN = lm(Y ~ X, data = df)
...}
I wrote like this to express if "WLD" and "EUN" both appear for product j then go to next product, but it did not work.
Aucun commentaire:
Enregistrer un commentaire