【发布时间】:2019-02-25 12:53:14
【问题描述】:
我有以下dataframe/tibble 示例:
structure(list(name = c("Contents.Key", "Contents.LastModified",
"Contents.ETag", "Contents.Size", "Contents.Owner", "Contents.StorageClass",
"Contents.Bucket", "Contents.Key", "Contents.LastModified", "Contents.ETag"
), value = c("2019/01/01/07/556662_cba3a4fc-cb8f-4150-859f-5f21a38373d0_0e94e664-4d5e-4646-b2b9-1937398cfaed_2019-01-01-07-54-46-064",
"2019-01-01T07:54:47.000Z", "\"378d04496cb27d93e1c37e1511a79ec7\"",
"24187", "e7c0d260939d15d18866126da3376642e2d4497f18ed762b608ed2307778bdf1",
"STANDARD", "vfevvv-edrfvevevev-streamed-data", "2019/01/01/07/556662_cba3a4fc-cb8f-4150-859f-5f21a38373d0_33a8ba28-245c-490b-99b2-254507431d47_2019-01-01-07-54-56-755",
"2019-01-01T07:54:57.000Z", "\"df8cc7082e0cc991aa24542e2576277b\""
)), row.names = c(NA, -10L), class = c("tbl_df", "tbl", "data.frame"
))
我想使用 tidyr::spread() 函数传播名称列,但我没有得到想要的结果
df %>% tidyr::spread(key = name, value = value)
我收到一个错误:
错误:行标识符重复:...
还尝试了melt 函数,结果相同。
我已使用aws.s3::get_bucket() 函数连接到 S3,并尝试将其转换为数据帧。我知道有一个 aws.s3::get_bucket_df() 函数应该这样做,但它不起作用(你可以看看我的 relevant question。
获得遗愿清单后,我将其取消列出并运行enframe 命令。
请指教。
【问题讨论】:
-
预期的结果是什么?第 2 列看起来有点乱,可能需要清理。
-
@NelsonGon 感谢您的回答,请告知为什么我的解决方案不能立即传播
标签: r dplyr tidyverse tidyr spread