在R中上传EPUB文件

问题描述

我正在尝试在r中读取EPUB文件。它放置在工作目录中。我写了这段代码

library(epubr)
library(tm)
x <- epub("Perchisuonalacampana.epub") # parse entire e-book

但是我得到了以下错误

Error in file.exists(path) : 
 file name conversion problem -- name too long?

(我的EPUB文件包含一本小说。)

编辑

getwd()
[1] "C:/Users/Standard/Downloads/aaa"
list.files()
[1] "dtm from pdf.R"            "Perchisuonalacampana.epub"

解决方法

从这两个来源(它们几乎相同):

  1. rdocumentation.org
  2. docs.ropensci.org

似乎您需要添加system.file()

library(epubr)
library(tm)

file <- system.file("Perchisuonalacampana.epub",package = "epubr")
x <- epub(file) # parse entire e-book

不确定这些方法是否还能提供帮助,但这里还有另外两种来源,采用的方法略有不同:

  1. docs.ropensci.org
  2. rdrr.io