@@ -69,18 +69,14 @@ parse_source <- function(source, base_url) {
69
69
# ' @export
70
70
as_tibble.covidcast_data_signal_list <- function (x , ... ) {
71
71
tib <- list ()
72
- tib $ source <- unname(map_chr(x , " source" ))
73
- tib $ signal <- unname(map_chr(x , " signal" ))
74
- tib $ name <- unname(map_chr(x , " name" ))
75
- tib $ active <- unname(map_lgl(x , " active" ))
76
- tib $ short_description <- unname(map_chr(x , " short_description" ))
77
- tib $ description <- unname(map_chr(x , " description" ))
78
- tib $ time_type <- unname(map_chr(x , " time_type" ))
79
- tib $ time_label <- unname(map_chr(x , " time_label" ))
80
- tib $ value_label <- unname(map_chr(x , " value_label" ))
81
- tib $ format <- unname(map_chr(x , " format" ))
82
- tib $ category <- unname(map_chr(x , " category" ))
83
- tib $ high_values_are <- unname(map_chr(x , " high_values_are" ))
72
+ fields <- c(
73
+ " source" , " signal" , " name" , " active" , " short_description" ,
74
+ " description" , " time_type" , " time_label" , " value_label" ,
75
+ " format" , " category" , " high_values_are"
76
+ )
77
+ for (field in fields ) {
78
+ tib [[field ]] <- unname(map_chr(x , field , .default = " " ))
79
+ }
84
80
as_tibble(tib )
85
81
}
86
82
@@ -184,11 +180,10 @@ covidcast_epidata <- function(base_url = global_base_url, timeout_seconds = 30)
184
180
# ' @export
185
181
as_tibble.covidcast_data_source_list <- function (x , ... ) {
186
182
tib <- list ()
187
- tib $ source <- unname(map_chr(x , " source" ))
188
- tib $ name <- unname(map_chr(x , " name" ))
189
- tib $ description <- unname(map_chr(x , " description" ))
190
- tib $ reference_signal <- unname(map_chr(x , " reference_signal" ))
191
- tib $ license <- unname(map_chr(x , " license" ))
183
+ fields <- c(" source" , " name" , " description" , " reference_signal" , " license" )
184
+ for (field in fields ) {
185
+ tib [[field ]] <- unname(map_chr(x , field , .default = " " ))
186
+ }
192
187
as_tibble(tib )
193
188
}
194
189
0 commit comments