我正在尝试使用ggvis
创建一个盒子图,即使只是一个简单的例子,我似乎无法查看一个
library(dplyr)
library(ggplot2)
library(shiny) #I think this is required? not sure
data.frame(theVar = c(1,5:10,15)) %>% ggvis(x = ~theVar) #makes a histogram
data.frame(theVar = c(1,5:10,15)) %>% ggvis(x = ~theVar) %>% layer_boxplots()
Error: Can't find prop y.update
强制y变量:
data.frame(theVar = c(1,5:10,15)) %>% ggvis(x = ~theVar,y=~theVar) %>% layer_boxplots()
似乎把它变成了间隔?不知道它在做什么,但它不是一个箱形图,箱形图也不需要X和Y ......
答案 0 :(得分:2)
如果您有一个变量,则必须将变量用于y
,并为x
指定一个虚拟变量:
library(ggvis)
data.frame(theVar = c(1,5:10,15)) %>% ggvis(y = ~theVar, x = ~ 1) %>% layer_boxplots()