R 将预内部代码嵌套到

R 将预内部代码嵌套到,r,shiny,R,Shiny,我是一个初学者,以光泽和以下的原则。我有一个代码块,在主面板内,如下所示: code( "# given path to a .txt file the function readCorpus loads # all sentences into a character vector and returns it readCorpus <- function(pathToFile){ con <- file(pathToFile)

我是一个初学者,以光泽和以下的原则。我有一个代码块,在
主面板内,如下所示:

code(
     "# given path to a .txt file the function readCorpus loads
      # all sentences into a character vector and returns it
      readCorpus <- function(pathToFile){
        con <- file(pathToFile) 
        # readLine throws a warning if the last line of the text file is not terminated 
        # by caridge return
        sentences <- readLines(con)
        close(con)
        return(sentences)
       }
")
code(
“#函数readCorpus加载的.txt文件的给定路径
#将所有句子转换为字符向量并返回它
阅读语料库