Function

コメント・参照等
  • 関数からコメント行を抽出する関数

FUN = f_extract_comments_from_function.r
function (f) 
{
    capturetxt0 <- capture.output(f)
    capturetxt1 <- gsub("^\\s+", "", capturetxt0)
    comments0 <- grep(pattern = "^#", x = capturetxt1)
    comments <- capturetxt1[intersect(comments0, seq(head(comments0, 1), by = 1, length.out = length(comments0)))]
    return(comments)
}

Asset Management Consulting Corporation