我希望能够将data.frame
\ data.table
对象中的数据作为csv文件直接从obj.to.write.s3 <- data.frame(cbind(x1=rnorm(1e6),x2=rnorm(1e6,5,10),x3=rnorm(1e6,20,1)))
目前,我先写入csv,然后上传到现有存储桶,然后使用以下方法删除文件:fn <- 'new-file-name.csv'
write.csv(obj.to.write.s3,file=fn)
system(paste0('aws s3 ',fn,' s3://my-bucket-name/',fn))
system(paste0('rm ',fn))
我想要一个直接写入s3的函数吗?那可能吗?
最佳答案
在aws.s3 0.2.2中添加了s3write_using()
(和s3read_using()
)功能。
它们使事情变得简单得多:
s3write_using(iris, FUN = write.csv,
bucket = "bucketname",
object = "objectname")
关于r - 将R数据作为csv直接写入s3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30084595/