我最近更新了ggvis
,当我在我的某个地块中使用filter
时,我现在收到错误消息。错误是:
"Error in filter(., area %in% eval(input_checkboxgroup(unique(rel_data$area), : (list) object cannot be coerced to type 'double'"
我的代码如下所示:
rel_data %>% ggvis(x = input_select(subject_names, map = as.name,
label = "X Axis"),
y = input_select(subject_names, map = as.name,
label = "Y Axis")) %>%
filter(area %in% eval(input_checkboxgroup(unique(rel_data$area),
selected = "Gut")))
这是一个可重复的例子:
names = c("Bacilli", "Actinobacteria", "area")
b_counts <- c(1,5,8,100,34)
a_counts <- c(1,3,11,55,67)
area <- c("Gut", "Skin", "Gut", "Gut", "Skin")
rel_data <- data.frame(b_counts, a_counts, area)
names(rel_data) <- names
library(ggvis)
rel_data %>% ggvis(x = input_select(names(rel_data[,-3]), map = as.name, label = "X Axis"),
y = input_select(names(rel_data[,-3]), map = as.name, label = "Y Axis")) %>%
filter(area %in% eval(input_checkboxgroup(unique(rel_data$area), selected = "Gut")))