我正在努力将应用程序部署到闪亮的服务器,但是不断收到与该文件夹的多个连接错误。
我已将数据的文件夹路径更改为相对路径,但继续收到错误
我应该如何格式化路径以更正连接错误?
这是Shiningserver中的错误:
Warning in file(con, "r") :
2019-05-04T23:12:48.548541+00:00 shinyapps[909445]: cannot open file '/home/shiny/PredModel//': No such file or directory
Warning: Error in file: cannot open the connection
2019-05-04T23:26:36.335363+00:00 shinyapps[909445]: summarize
2019-05-04T23:26:36.338119+00:00 shinyapps[909445]: Warning in file(con, "r") :
2019-05-04T23:26:36.336218+00:00 shinyapps[909445]:
2019-05-04T23:26:36.343050+00:00 shinyapps[909445]: 61: file
2019-05-04T23:26:36.343052+00:00 shinyapps[909445]: 60: FUN
2019-05-04T23:26:36.343053+00:00 shinyapps[909445]: 59: lapply
2019-05-04T23:26:36.338121+00:00 shinyapps[909445]: cannot open file '/srv/connect/apps/PredModel\Badwords.txt': No such file or directory
这是读取文件的代码
##Import Multiple Documents (Corpus)
folder <- "~/PredModel"
files <- list.files(path = folder, pattern = "*.txt")
##Combine Files & Load Data
files <- paste(folder, "//", files, sep= "")
txtdoc <- lapply(files, FUN = readLines)
##File Sizes
blogslinecount <- length(txtdoc[[1]]) ; blogswords <- sum(stri_count_words(txtdoc[[1]]))
newslinecount <- length(txtdoc[[2]]) ; newswords <- sum(stri_count_words(txtdoc[[2]]))
twitterlinecount <- length(txtdoc[[3]]) ; twitterwords <- sum(stri_count_words(txtdoc[[3]]))
## Take Sample of Txt
txtdoc[[1]] <- sample(txtdoc[[1]], length(txtdoc[[1]]) *.25, replace = TRUE)
txtdoc[[2]] <- sample(txtdoc[[2]], length(txtdoc[[2]]) *.25, replace = TRUE)
txtdoc[[3]] <- sample(txtdoc[[3]], length(txtdoc[[3]]) *.25, replace = TRUE)
txtdoc1 <- lapply(txtdoc, FUN=paste, collapse = " ") #collapse into one character element
##Upload Profanity words to be removed
profanity <- readLines("Badwords.txt", encoding = "UTF-8")
profanity <- paste(profanity[1])