首页 > 解决方案 > 在 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"

标签: rfileepub

解决方案


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

  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

推荐阅读