Last active
August 29, 2019 17:09
-
-
Save paleolimbot/ec9b62b758ae57a5b4669fa771fc40a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tibble) | |
library(tidyr) | |
df <- tibble( | |
dataset = c("ec_climate", "ec_climate"), | |
location = c("KENTVILLE CDA CS NS 27141", "KENTVILLE CDA CS NS 27141"), | |
result = list( | |
tibble( | |
`Max Temp Flag` = character(0), | |
`Min Temp (°C)` = character(0), | |
`Min Temp Flag` = character(0), | |
`Mean Temp (°C)` = character(0) | |
), | |
tibble( | |
`Max Temp Flag` = rep(NA_character_, 6), | |
`Min Temp (°C)` = rep(NA_character_, 6), | |
`Min Temp Flag` = rep(NA_character_, 6), | |
`Mean Temp (°C)` = rep(NA_character_, 6) | |
) | |
) | |
) | |
unnest(df, result) | |
bad_df_file <- tempfile(fileext = ".rds") | |
curl::curl_download( | |
"https://gist.github.com/paleolimbot/ec9b62b758ae57a5b4669fa771fc40a0/raw/e96b55f54d68b1cb3877bb358b28b99dc8836ceb/bad_df.rds", | |
bad_df_file | |
) | |
df2 <- readr::read_rds(bad_df_file) | |
df2$result <- lapply(df2$result, function(x) { | |
attr(x, "flag_info") <- NULL | |
x | |
}) | |
testthat::expect_identical(df, df2) | |
unnest(df2, result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created on 2019-08-29 by the reprex package (v0.2.1)