trinker / qdap

Quantitative Discourse Analysis Package: Bridging the gap between qualitative data and quantitative analysis
http://cran.us.r-project.org/web/packages/qdap/index.html
175 stars 44 forks source link

sentSplit check text optional #195

Closed trinker closed 10 years ago

trinker commented 10 years ago

consider an argument defaulting to TRUE in sentSplit for checking text. Also may be an issue with check_text. Consider the following example:

z <- lapply(split(raj.act.1$dialogue, raj.act.1$person), paste, collapse = " ")

lapply(seq_along(z), function(i) {
    x <- try(phrase_net(sent_detect(z[i]), r=.6))
    if (!inherits(x, "try-error")) {
        dev.new()
        print(x)
        mtext(names(z)[i], padj=-1, cex=1.7, col="red")
    }
}) 

output

Error in setNames(data.frame(data), value.name) : 
  'names' attribute [1] must be the same length as the vector [0]
In addition: Warning messages:
1: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
2: In word_cor(text.var[, "text"], text.var[, "tot"], word = Filtered_dat[,  :
  Only `sir` was found in the data set. NULL returned
Error in setNames(data.frame(data), value.name) : 
  'names' attribute [1] must be the same length as the vector [0]
In addition: Warning messages:
1: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
2: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
3: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
4: In word_cor(text.var[, "text"], text.var[, "tot"], word = Filtered_dat[,  :
  No words found in the data set.  NULL returned
Error in value[[jvseq[[jjj]]]] : subscript out of bounds
In addition: Warning message:
In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
Error in value[[jvseq[[jjj]]]] : subscript out of bounds
In addition: Warning message:
In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
Error in value[[jvseq[[jjj]]]] : subscript out of bounds
In addition: Warning message:
In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
Error in setNames(data.frame(data), value.name) : 
  'names' attribute [1] must be the same length as the vector [0]
In addition: Warning messages:
1: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
2: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
3: In word_cor(text.var[, "text"], text.var[, "tot"], word = Filtered_dat[,  :
  No words found in the data set.  NULL returned
Error in setNames(data.frame(data), value.name) : 
  'names' attribute [1] must be the same length as the vector [0]
In addition: Warning messages:
1: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
2: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character, non space after comma

*Consider running `check_text`
3: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character, non space after comma

*Consider running `check_text`
4: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
5: In word_cor(text.var[, "text"], text.var[, "tot"], word = Filtered_dat[,  :
  No words found in the data set.  NULL returned
Error in setNames(data.frame(data), value.name) : 
  'names' attribute [1] must be the same length as the vector [0]
In addition: Warning messages:
1: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character, non space after comma

*Consider running `check_text`
2: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
3: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
4: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
5: In word_cor(text.var[, "text"], text.var[, "tot"], word = Filtered_dat[,  :
  No words found in the data set.  NULL returned
Error in setNames(data.frame(data), value.name) : 
  'names' attribute [1] must be the same length as the vector [0]
In addition: Warning messages:
1: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
2: In word_cor(text.var[, "text"], text.var[, "tot"], word = Filtered_dat[,  :
  No words found in the data set.  NULL returned
Error in value[[jvseq[[jjj]]]] : subscript out of bounds
In addition: Warning messages:
1: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`
2: In sentSplit(data.frame(text = text.var), "text") :
  The following problems were detected:
non character

*Consider running `check_text`