Hi,
First off I know there is textfile for reading a corpus source from a file but for my purposes it would not do since the texts are newline separated.
When I take a corpus whose source is from a character vector whose source is from readLines and call sample on it, the result is a corpus that appears to be an incorrect state instead of a character vector as expected. The functions that expect a corpus such as ndoc do function normally, and corpus$document is a vector of character instead of a data frame. However, setting the document-level meta-data prior to using sample seems to circumvent this issue.
Reproducibility:
R version 3.2.4 (2016-03-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.4 (El Capitan)
RStudio Version 0.99.893
quanteda_0.9.4
mybug.zip
Hi,
First off I know there is
textfilefor reading a corpus source from a file but for my purposes it would not do since the texts are newline separated.When I take a corpus whose source is from a character vector whose source is from
readLinesand callsampleon it, the result is a corpus that appears to be an incorrect state instead of a character vector as expected. The functions that expect a corpus such asndocdo function normally, andcorpus$documentis a vector of character instead of a data frame. However, setting the document-level meta-data prior to usingsampleseems to circumvent this issue.Reproducibility:
R version 3.2.4 (2016-03-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.4 (El Capitan)
RStudio Version 0.99.893
quanteda_0.9.4
mybug.zip