highcharter-helper: improve handling of single query terms
Change-Id: I057f88c5bdf100cc1464b7a2c211db7a41e228c5
diff --git a/R/highcharter-helper.R b/R/highcharter-helper.R
index 76ebdc7..ad2168c 100644
--- a/R/highcharter-helper.R
+++ b/R/highcharter-helper.R
@@ -49,9 +49,11 @@
queryStringToLabel(vc, excludePubDate = TRUE )))
}
} else {
- title <- base::unique(df$query)
- if(length(base::unique(queryStringToLabel(df$vc, excludePubDate = TRUE ))) > 1) {
+ if (length(base::unique(queryStringToLabel(df$vc, excludePubDate = TRUE ))) > 1) {
+ title <- base::unique(df$query)
df <- df %>% mutate(condition = queryStringToLabel(vc, excludePubDate = TRUE ))
+ } else {
+ df <- df %>% mutate(condition = query)
}
}
}