【发布时间】:2021-04-23 06:50:00
【问题描述】:
我有一个包含 csv 文件的 .rar 存档。 .rar 有密码,我想用 R Studio 读取它(csv 是 .rar 中唯一的文件)。
我尝试使用以下代码:
library(Hmisc)
getZip("datos/diarios.rar", password = "israel")
但是 R 返回了这个:
A connection with
description "C:\\WINDOWS\\system32\\cmd.exe /c unzip -p -P israel datos/diarios.rar"
class "pipe"
mode "r"
text "text"
opened "closed"
can read "yes"
can write "yes"
我该如何解决这个问题?
当我在上面运行read.csv 时,它不起作用。看:
read.csv(gzfile("datos/diarios.zip", open = ""), header = T)
read.table 中的错误(文件 = 文件,标题 = 标题,sep = sep,quote = 引用,:比列名更多的列另外:警告消息: 1: 在 read.table(file = file, header = header, sep = sep, quote = 引用,:第 1 行似乎包含嵌入的空值 2:在 read.table(file = file, header = header, sep = sep, quote = quote, : 第 2 行似乎包含嵌入的空值
【问题讨论】:
-
从帮助页面看来,例如,在此使用
read.csv -
它不起作用。看:在 read.csv(gzfile("datos/diarios.zip", open = ""), header = T) 错误 read.table(file = file, header = header, sep = sep, quote = quote, :比列名更多的列另外:警告消息:1:在read.table(文件=文件,标题=标题,sep=sep,quote=quote,:第1行似乎包含嵌入的空值2:在read.table( file = file, header = header, sep = sep, quote = quote, : 第 2 行似乎包含嵌入的空值
-
现在看起来更像是数据和 read.csv 的问题,而不是打开压缩文件。不幸的是,如果没有数据,这有点难以解决。你能在文本编辑器中打开它看看吗?
标签: r unzip password-encryption unrar