for,if函数,求指导

##Create a new column called "employment_length_days".
#Fill this new column (“employment_length_days”) using a for loop and if statement with the following conditions:
#For those STILL employed (DO NOT have a "termination_date"), find the difference between August 11, 2021 and their "hire_date".
#For those NO LONGER employed (DO have a "termination_date"), find the difference between their "termination_date" and their "hire_date".
#1: Prior to your loop, set the current date using the following: today <- as.Date("2021-08-11")
#2: Then, you could use the "difftime" function to calculate the correct number of days. As an example: difftime(x,y)

我目前的进度
for (i in 1:nrow(Employees)) {
if (Employees$termination_date = "NULL") {
difftime(2021-08-11, Employees$hire_date) <- Employees$employment_length_days
} else if (Employees$termination_date = "") {
difftime(Employees$termination_date, Employees$hire_date) <- Employees$employment_length_days
}
}

https://ask.csdn.net/questions/222703?spm=1005.2026.3001.5635&utm_medium=distribute.pc_relevant_ask_down.none-task-ask-2~default~OPENSEARCH~Rate-1-222703-ask-7770692.pc_feed_download_top3ask&depth_1-utm_source=distribute.pc_relevant_ask_down.none-task-ask-2~default~OPENSEARCH~Rate-1-222703-ask-7770692.pc_feed_download_top3ask