Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Now genX and bracketX remove extra spaces left over from their removal.

  • Loading branch information...
commit 5c6ecfbb0bc3e6e141482ef8e2fca2822fc4e0df 1 parent 61de1b7
@trinker authored
Showing with 19 additions and 11 deletions.
  1. +2 −0  NEWS
  2. +10 −10 R/bracketX.R
  3. +6 −0 R/read.transcript.R
  4. +1 −1  inst/maintenance.R
View
2  NEWS
@@ -14,6 +14,8 @@ NEW FEATURES
MINOR FEATURES
+* `genX` and `bracketX` now remove extra spaces left over from their removal.
+
CHANGES
* qdap is now compiled for mac users (as openNLP now passes CRAN checks with no
View
20 R/bracketX.R
@@ -60,16 +60,16 @@ function (text.var, bracket = "all", missing = NULL, names = FALSE,
scrub = TRUE) {
FUN <- function(bracket, text.var, missing, names) {
X <- switch(bracket,
- html = sapply(text.var, function(x) gsub("<.+?>", "", x)),
- angle = sapply(text.var, function(x) gsub("<.+?>", "", x)),
- square = sapply(text.var, function(x) gsub("\\[.+?\\]", "", x)),
- round = sapply(text.var, function(x) gsub("\\(.+?\\)", "", x)),
- curly = sapply(text.var, function(x) gsub("\\{.+?\\}", "", x)),
+ html = sapply(text.var, function(x) gsub("[ ]*<.+?>[ ]*", "", x)),
+ angle = sapply(text.var, function(x) gsub("[ ]*<.+?>[ ]*", "", x)),
+ square = sapply(text.var, function(x) gsub("[ ]*\\[.+?\\][ ]*", "", x)),
+ round = sapply(text.var, function(x) gsub("[ ]*\\(.+?\\)[ ]*", "", x)),
+ curly = sapply(text.var, function(x) gsub("[ ]*\\{.+?\\}[ ]*", "", x)),
all = {
- P1 <- sapply(text.var, function(x) gsub("\\[.+?\\]", "", x))
- P1 <- sapply(P1, function(x) gsub("\\(.+?\\)", "", x))
- P1 <- sapply(P1, function(x) gsub("<.+?>", "", x))
- sapply(P1, function(x) gsub("\\{.+?\\}", "", x))
+ P1 <- sapply(text.var, function(x) gsub("[ ]*\\[.+?\\][ ]*", "", x))
+ P1 <- sapply(P1, function(x) gsub("[ ]*\\(.+?\\)[ ]*", "", x))
+ P1 <- sapply(P1, function(x) gsub("[ ]*<.+?>[ ]*", "", x))
+ sapply(P1, function(x) gsub("[ ]*\\{.+?\\}[ ]*", "", x))
}
)
if (scrub) {
@@ -168,7 +168,7 @@ function (text.var, left, right, missing = NULL, names = FALSE, scrub = TRUE) {
left <- mgsub(specchar, paste0("\\", specchar), left, fixed = TRUE)
right <- mgsub(specchar, paste0("\\", specchar), right, fixed = TRUE)
FUN <- function(left, right, text.var, missing, names) {
- X <- sapply(text.var, function(x) gsub(paste0(left, ".+?", right), "", x))
+ X <- sapply(text.var, function(x) gsub(paste0("[ ]*", left, ".+?", right, "[ ]*"), "", x))
if (scrub) {
X <- scrubber(gsub(" +", " ", X))
}
View
6 R/read.transcript.R
@@ -108,6 +108,12 @@ function(file, col.names = NULL, text.var = NULL, merge.broke.tot = TRUE,
strip.white = TRUE, stringsAsFactors = FALSE,
blank.lines.skip = rm.empty.rows, ...)
},
+ xls = {
+ x <- read.xls(file, header = header,
+ sep = sep, as.is=FALSE, na.strings= na.strings,
+ strip.white = TRUE, stringsAsFactors = FALSE,
+ blank.lines.skip = rm.empty.rows, ...)
+ },
docx = {
x <- read.docx(file, skip = skip, sep = sep)
},
View
2  inst/maintenance.R
@@ -8,7 +8,7 @@ library(highlight); library(qdap); library(staticdocs); library(acc.roxygen2)
#right now examples are FALSE in the future this will be true
#in the future qdap2 will be the go to source
build_package(package="C:/Users/trinker/GitHub/qdap",
- base_path="C:/Users/trinker/Desktop/qdap_dev/", examples = FALSE)
+ base_path="C:/Users/trinker/Desktop/qdap_dev/", examples = TRUE)
#STEP 2: reshape index
path <- "C:/Users/trinker/Desktop/qdap_dev"
Please sign in to comment.
Something went wrong with that request. Please try again.