Description Usage Arguments Details Examples
Given filenames, folder names, or the mixture of the two, the function will read texts in .txt or other separated files, and then write them into one .csv file. It helps those who prefer texts in a table format.
1 |
... |
names of folders and files, obtained files may end with ".txt" or not , see below. Encoding for each file is auto-detected. |
csv |
a .csv file that will contain texts. It must end with ".csv". |
must_txt |
should be |
na_in_txt |
character vector that specifies what content, when it occupies a single line,
should be treated as |
Whether a file is taken as NA
is judged by scancn
. " " (a space)
is also taken as NA
. However, you
can further decide what else is deemed as NA
, e. g., "404 ERROR", if your texts are from
websites. If a file cannot be accessed, the result to be
written in the corresponding cell of csv file will become NA
, and there will be a
message, but no error is raised.
In the .csv file, full filenames of txt occupy a column and fulltexts occupy another.
1 2 3 4 5 6 | ## Not run:
x1 <- file.path(find.package("base"), "CITATION")
x2 <- file.path(find.package("base"), "DESCRIPTION")
txt2csv(x1, x2, must_txt = FALSE, csv = 'x1x2csv.csv')
## End(Not run)
|
Warning messages:
1: In Sys.setlocale(category = "LC_COLLATE", s_right_locale) :
OS reports request to set locale to "zh_CN.UTF-8" cannot be honored
2: In Sys.setlocale(category = "LC_CTYPE", s_right_locale) :
OS reports request to set locale to "zh_CN.UTF-8" cannot be honored
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.