我有一个已写入笔记本文件系统的 csv 文件:
# read csv from object storage
df = read.csv2( ... )
# do some operations ...
# save new csv to notebook filesystem
file.remove('example.csv')
write.csv(df, file = "example.csv")
如何将此文件复制到项目的云对象存储中?
我有一个已写入笔记本文件系统的 csv 文件:
# read csv from object storage
df = read.csv2( ... )
# do some operations ...
# save new csv to notebook filesystem
file.remove('example.csv')
write.csv(df, file = "example.csv")
如何将此文件复制到项目的云对象存储中?
这对我有用:
# import projectLib
library(projectLib)
project <- projectLib::Project$new(projectId="secret, projectToken="secret")
# get the file size:
csv.size = file.size('example.csv')
# read the file as a byte array
bytes.to.save = readBin('example.csv', 'raw', n = csv.size, size = NA_integer_,
signed = TRUE, endian = .Platform$endian)
# save the file to cloud object storage
project$save_data("example.csv", bytes.to.save, overwrite = TRUE)