R言語で土日祝日を除いた日数の計算結果をデータフレームへ


Rで土日祝日を除いた開始日と終了日の間の日数を計算しようとしましたが、上手くいきません。  
ベクトルの型が上手くいかないものと思いますが、何か上手くやる方法はありませんでしょうか。

[code]

    library(dplyr)    
    p1 <- c(1:2)
    p2 <- as.Date(c("2013-01-01","2013-01-22"))
    p3 <- as.Date(c("2013-01-11","2013-01-30"))
    df2 <- data_frame(p1,p2,p3)
    names(df2) <- c("st_date", "ed_date")
    
    # 政府のcsvより作成：祝日リスト
    holidays <- c("1995/1/1",
                  "1995/1/2",
                  "1995/1/15",
    ～略~
                  "2023/10/9",
                  "2023/11/3",
                  "2023/11/23"
                  )
    
    # https://ja.stackoverflow.com/questions/29838/r%e8%a8%80%e8%aa%9e%e3%81%a7%e5%9c%9f%e6%97%a5%e7%a5%9d%e6%97%a5%e3%82%92%e9%99%a4%e3%81%84%e3%81%9f%e6%97%a5%e6%95%b0%e3%81%ae%e8%a8%88%e7%ae%97を参考
    library(timeDate)
    heijitu.f <- function(start, end) {
      hol1995_2023 <- as.Date(unlist(holidays))
      days <- seq.Date(as.Date(start), as.Date(end), by="day")
      result <- length(days[timeDate::isWeekday(days) &! (days %in% hol1995_2023)])
      return(result)
    }
    
    df2 <- df2 %>% dplyr::mutate(heijitu.f(st_date, ed_date))
    # ここでエラー：'from' must be of length 1
    
[/code]



[code]

    library(dplyr)    
    
    p1 <- c(1:2)
    p2 <- as.Date(c("2013-01-01","2013-01-22"))
    p3 <- as.Date(c("2013-01-11","2013-01-30"))
    df2 <- data_frame(p1,p2,p3)
    names(df2) <- c("no", "st_date", "ed_date")
    
    # 政府のcsvより作成：祝日リスト
    holidays <- c("1995/1/1",
                  "1995/1/2",
                  "1995/1/15",
    ～略~
                  "2023/10/9",
                  "2023/11/3",
                  "2023/11/23"
                  )
    
    library(timeDate)
    heijitu.f <- function(start, end) {
      hol1995_2023 <- as.Date(unlist(holidays))
      days <- seq.Date(as.Date(start), as.Date(end), by="day")
      result <- length(days[timeDate::isWeekday(days) &! (days %in% hol1995_2023)])
      return(result)
    }
    
    df2 <- df2 %>% rowwise() %>% mutate(days = heijitu.f(st_date, ed_date))
    
    print(df2)
    
    #
         no st_date    ed_date     days
      <int> <date>     <date>     <int>
    1     1 2013-01-01 2013-01-11     8
    2     2 2013-01-22 2013-01-30     7
    
[/code]



[code]

    library(dplyr)    
    
    p1 <- c(1:2)
    p2 <- as.Date(c("2013-01-01","2013-01-22"))
    p3 <- as.Date(c("2013-01-11","2013-01-30"))
    df2 <- data_frame(p1,p2,p3)
    names(df2) <- c("no", "st_date", "ed_date")
    
    # 政府のcsvより作成：祝日リスト
    holidays <- c("1995/1/1",
                  "1995/1/2",
                  "1995/1/15",
    ～略~
                  "2023/10/9",
                  "2023/11/3",
                  "2023/11/23"
                  )
    
    library(timeDate)
    heijitu.f <- function(start, end) {
      hol1995_2023 <- as.Date(unlist(holidays))
      days <- seq.Date(as.Date(start), as.Date(end), by="day")
      result <- length(days[timeDate::isWeekday(days) &! (days %in% hol1995_2023)])
      return(result)
    }
    
    df2 <- df2 %>% rowwise() %>% mutate(days = heijitu.f(st_date, ed_date))
    
    print(df2)
    
    #
         no st_date    ed_date     days
      <int> <date>     <date>     <int>
    1     1 2013-01-01 2013-01-11     8
    2     2 2013-01-22 2013-01-30     7
    
[/code]

