From fa4201d558255728d6751c5c9ed1bc1449a7abfa Mon Sep 17 00:00:00 2001 From: John Coene Date: Tue, 11 Jul 2017 17:35:17 +0800 Subject: [PATCH] clean tweaks -> rmvd empty lines --- R/clean.R | 6 ++++-- man/rm_comments.Rd | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/R/clean.R b/R/clean.R index 06f6d36..c5b15a7 100644 --- a/R/clean.R +++ b/R/clean.R @@ -6,6 +6,7 @@ #' #' @details Example of comment removed #' \code{UNCLASSIFIED U.S. Department of State Case No. F-2014-20439 Doc No. C05765911 Date: 08/31/2015} +#' look at the source code for more details \code{rm_comments} #' #' @examples #' \dontrun{ @@ -19,8 +20,9 @@ rm_comments <- function(emails){ if(missing(emails)) stop("must pass emails") lapply(emails, function(x){ - x <- gsub("UNCLASSIFIED U.S. Department of State Case \\w+?[[:punct:]]?[[:space:]]", "", x) - x <- gsub("F-[0-9]+-[0-9]+?\\sDoc\\sNo.?\\s[A-Z][0-9]{8}?\\sDate[[:punct:]]\\s[0-9]{2}[[:punct:]][0-9]{2}[[:punct:]][0-9]{4}", "", x) + x <- x[!grepl("UNCLASSIFIED U.S. Department of State Case \\w+?[[:punct:]]?[[:space:]]", x)] + x <- x[!grepl("F-[0-9]+-[0-9]+?\\sDoc\\sNo.?\\s[A-Z][0-9]{8}?\\sDate[[:punct:]]\\s[0-9]{2}[[:punct:]][0-9]{2}[[:punct:]][0-9]{4}", x)] + x <- x[!grepl("RELEASE IN", x)] return(x) }) } diff --git a/man/rm_comments.Rd b/man/rm_comments.Rd index 4165cf2..e47f2b3 100644 --- a/man/rm_comments.Rd +++ b/man/rm_comments.Rd @@ -15,6 +15,7 @@ Remove comments \details{ Example of comment removed \code{UNCLASSIFIED U.S. Department of State Case No. F-2014-20439 Doc No. C05765911 Date: 08/31/2015} +look at the source code for more details \code{rm_comments} } \examples{ \dontrun{