Question: I would like to install Lotus Notes 7/designer/client/admin on same computer probably in other drive, where we have already installed Lotus notes 9. therefore I would like to know if this would create any conflict ? or any probable issues ? or some one can please explain me how to do that any guidance.

Answer: 
You're looping over every single row. It's not surprising it is slow. You could essentially do one replacement operation instead where you take a fixed difference from each date: 0 for M-F, -1 for Sat and -2 for Sun. 

```
# 'big' sample data
x <- Sys.Date() + 0:100000

bizdays <- function(x) x - match(weekdays(x), c("Saturday","Sunday"), nomatch=0)

# since `weekdays()` is locale-specific, you could also be defensive and do:
bizdays <- function(x) x - match(format(x, "%w"), c("6","0"), nomatch=0)

system.time(bizdays(x))
#   user  system elapsed 
#   0.36    0.00    0.35 

system.time(previous_business_date_if_weekend(x))
#   user  system elapsed 
#  45.45    0.00   45.57 

identical(bizdays(x), previous_business_date_if_weekend(x))
#[1] TRUE

```
Just to add another possibility: A pure R implementation is in the [`datetimetutils`](https://CRAN.R-project.org/package=datetimeutils) package (of which I am the author). The function `previous_businessday` converts to `POSIXlt` in order to extract the weekday.
(The code compares the function's results with the function `bizdays` suggested by thelatemail.)

```
library("datetimeutils")

x <- Sys.Date() + 0:100000

system.time(bizdays(x))
## user  system elapsed 
## 0.25    0.00    0.25 

system.time(previous_businessday(x, shift = 0))
## user  system elapsed 
## 0.03    0.00    0.03 

identical(bizdays(x), previous_businessday(x, shift = 0))
## TRUE

```

A slightly-simplified version of `previous_businessday` would look as follows; it assumes that `x` is of class `Date`.

```
previous_bd <- function(x) {
    tmp <- as.POSIXlt(x)
    tmpi <- tmp$wday == 6L
    x[tmpi] <- x[tmpi] - 1L
    tmpi <- tmp$wday == 0L
    x[tmpi] <- x[tmpi] - 2L
    x
}

system.time(previous_bd(x))
## user  system elapsed 
## 0.03    0.00    0.03 

identical(bizdays(x), previous_bd(x))
## TRUE

```