In the future, please follow the questions guidelines.
library(lubridate)
start = as.Date(c("14.01.2015", "26.03.2015"),format = "%d.%m.%Y")
end = as.Date(c("18.01.2015", NA),format = "%d.%m.%Y")
diff = ifelse(!is.na(end),difftime(end,start,units="days"),difftime(Sys.time(),start,units="days"))
df = data.frame(start,end,diff)
View(df)
start end diff
1 2015-01-14 2015-01-18 4.0000
2 2015-03-26 NA 174.7846
solved How to get date difference if column is NA [closed]