Hi @alexkgold,

Hi @andresrcs

Please find below the reproducible code. Please let me know if i missed anything,

```
library(lubridate)
df1 <- data.frame(Job.cat = c(2L, 3L, 4L, 5L, 6L),
skill = as.factor(c("Art", "science", "maths", "maths", "sciencce")),
conditions = as.factor(c("L", "E", "L", "L", "L")),
work_location = as.factor(c("IND", "NZ", "CHI", "SWT", "IND")),
Date.created = as.factor(c("1/30/2016", "2/27/2017", "3/20/2018",
"4/22/2017", "5/26/2018")))
df2 <- data.frame(Job.cat = c(2L, 3L, 4L, 5L, 3L, 2L, 3L, 3L, 5L, 5L, 5L),
Base.Country = as.factor(c("IND", "NZ", "NZ", "SWT", "IND", "IND", "IND",
"IND", "SWT", "SWT", "SWT")),
Date.Available = as.factor(c("1/30/2016", "7/22/2017", "10/30/2018",
"12/26/2017", "6/25/2016", "2/21/2016",
"12/21/2015", "10/21/2015", "1/22/2017", "7/22/2017",
"11/22/2016")),
skill = as.factor(c("Art", "science", "maths", "maths", "sciencce",
"maths", "maths", "sciencce", "maths", "maths",
"sciencce")))
df1$Date.created <- mdy(df1$Date.created)
df2$Date.Available <- mdy(df2$Date.Available)
# To view the lesser and greater 6 month range
df1$lessmonth <- as.Date(df1$Date.created) %m-% months(6)
df1$greatmonth <- as.Date(df1$Date.created) %m+% months(6)
for (i in 1:nrow(df1)){
count <- 0
for (j in 1:nrow(df2)){
if((df1[i, "skill"] == df2[j,"skill"])&
(df1[i, "job.cat"] == df2[j, "job.cat"] | df1[i, "job.cat"] +1 == df2[j, "job.cat"])&
((df1[i, "conditions"]) == "L")&
(df1[i, "work_location"] == df2[j, "Base.Country"])&
else if ((df1[i, "conditions"]) == "E""] then [(df1[i, "work_location"] == df2[j, "work_location])&
(df2[j, "Date.Available"] >= df1[i, "lessmonth1"] & df2[j, "Date.Available"] <= df1[i, "greatmonth1"])
)
count <- count + 1
}
print(count)
df1[i, "out"] <- count
}
#error Error during wrapup: unexpected 'else' in:
" (df1[i, "work_location"] == df2[j, "Base.Country"])&
else"
```