【发布时间】:2017-09-07 18:24:02
【问题描述】:
我正在尝试使用 aws.s3 库从我的 Rstudio 会话中读取 AWS S3。我正在关注this instructions。以下几行
obj <-get_object("s3://my_bucket/myfile.csv")
csvcharobj <- rawToChar(obj)
con <- textConnection(csvcharobj)
data <- read.csv(file = con)
在阅读csv 文件时工作得很好。但以下替代方法会为 txt 文件返回错误。
obj <-get_object("s3://my_bucket/myfile.txt")
csvcharobj <- rawToChar(obj)
con <- textConnection(csvcharobj)
data <- read.table(file = con)
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 1 did not have 6 elements
对这个问题有什么建议的解决方案吗?谢谢。
【问题讨论】:
-
是您的文本文件表格格式,我的意思是 read.table 需要数据为表格格式,如 csv stat.ethz.ch/R-manual/R-devel/library/utils/html/…
标签: r amazon-web-services amazon-s3 rstudio