尝试使用命令devtools::document(roclets=c('rd', 'collate', 'namespace', 'vignette'))
构建软件包时,出现以下错误:
Error in parse(text = lines, n = -1, srcfile = srcfile) :
/home/leo/Documents/Logiciels/WikiSocio/R/clean_wikitext.R:
31:18:INCOMPLETE_STRING inattendu(e)
30: revs %<>% gsub("\\[\\[Fichier:[^*][^\r\n]+", " ", ., perl = TRUE)
31: revs %<>% gsub("\\[\\[Cat
文件的完整代码来自问题所在:
revs %<>% gsub("(?>\\{(?:[^{}]*|(?R))*\\})", " ", ., perl = TRUE)
revs %<>% gsub("<references*[^<]*(?:<(?!/>)[^<]*)*(/>|\r\n)", " ", ., perl = TRUE)
revs %<>% gsub("<(ref|references)\\b[^<]*>[^<]*(?:<(?!/ref>)[^<]*)*</ref>", " ", ., perl = TRUE)
revs %<>% gsub("\\[\\[Fichier:[^*][^\r\n]+", " ", ., perl = TRUE)
revs %<>% gsub("\\[\\[Catégorie:[^*][^\r\n]+", " ", ., perl = TRUE)
revs %<>% gsub("=[^*][^\r\n]+", " ", ., perl = TRUE)
revs %<>% gsub("\\;[^*][^\r\n]+", " ", ., perl = TRUE)
revs %<>% gsub("\\[\\[(?:[^|\\]]*\\|)?([^\\]]+)\\]\\]", "\\1", ., perl = TRUE)
revs %<>% sapply(str_to_lower, locale)
revs %<>% removeWords(stopwords(locale))
revs %<>% gsub("[\r\n]+", " ", ., perl = TRUE)
revs %<>% gsub("[[:punct:]]", " ", .)
revs %<>% gsub("(?<=[\\s])\\s*|^\\s+|\\s+$", "", ., perl=TRUE)
revs %<>% unname
之前已装入软件包tm
,magrittr
和stringr
。
这是我的sessionInfo:
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.4 tools_3.4.4 yaml_2.2.0