ggvis

Identify points within a rectangle in a scatterplot

风格不统一 提交于 2019-12-12 03:36:17
问题 I have a small R script that loads in a comma-separated file with data and displays it as a scatterplot. I can also identify individual points of interest in the scatterplot by hovering over them with the mouse. This is cool but what I also want is to draw a rectangle over an area in the scatterplot, and get a list with the IDs of the data points within that rectangle. (The final goal of this is a shiny app). I.e. how can I make it so that I can a) draw a rectangle, b) get the points within

Linked brushing not refreshing with ggvis and shiny

こ雲淡風輕ζ 提交于 2019-12-12 00:27:56
问题 As a part of my shiny app, i am trying to have linked brushing so that i can subset my data via a brush and display that data in a separate ggvis plot relevant (simple) code is as follows: lb <- linked_brush(keys = 1:nrow(filteredData()), "red") observe({filteredData() %>% ggvis(~id, ~y) %>% layer_points() %>% layer_points(fill := lb$fill, size.brush := 400) %>% lb$input() %>% bind_shiny("plot") filteredData() %>% ggvis(~id, ~y) %>% lb$input() %>% layer_points( data = reactive(filteredData()

shiny + ggvis: reactive using ggvis “tilde” or “~”

强颜欢笑 提交于 2019-12-11 19:44:31
问题 All I want is an efficient way to set the ggvis fill property in server.R according to the InputSelect box in ui.R . Since the fill property syntax needs a " tilde " or " ~ " I was unable to come with a solution. The ui.R and server.R below are just one of my solutions attempts: my switch statement below is wrong since I get a " Error in switch(select, mpg = { : EXPR must be a length 1 vector ". Don't hesitate to propose something completely different. Thanks in advance for your support ! ui

navbarPage shiny with two datasets and identical set of widgets - both ways dependence

ε祈祈猫儿з 提交于 2019-12-11 18:08:33
问题 I try to create a simple shiny app. What we have here is app with two tabPanel modules, each refers to different dataset. Actually both datasets have the same structure (i.e. name of column, name of factors within columns), only difference is column value and number of instances in those columns. I would like to create the same layout of each tabPanel . I try to depend widget in Module 1 on widget in Module 2 . For example, if I choose product P2 in Module 1 and then change tabPanel into

ggvis layer_bars and layer_lines on different y-axis

怎甘沉沦 提交于 2019-12-11 11:05:59
问题 I would like to create a plot with categorical x values and lines and bars. The example data is as follows: dataWide <- iris %>% group_by(Species) %>% summarize(sl = mean(Sepal.Length), sw = mean(Sepal.Width), pl = mean(Petal.Length), pw = mean(Petal.Width)) # Source: local data frame [3 x 5] # # Species sl sw pl pw # 1 setosa 5.006 3.428 1.462 0.246 # 2 versicolor 5.936 2.770 4.260 1.326 # 3 virginica 6.588 2.974 5.552 2.026 I want to have: setosa, versicolor, and virginica on the x-axis.

reactive updates in shiny app - one-way dependence

廉价感情. 提交于 2019-12-11 10:26:43
问题 In the previous problem with reactive updates @NicE helps me understand how it works. Nevertheless, there is another issue here. Based on my code (included below) every time I change radioButtons widget, the value in selectInput widget automatically come back to the id value, even if I do not want to. For example, when I change L1 -> L3 and then change Ordering -> Part name and then I want to go to L3 -> L2 , selectInput widget automatically come back to the Ordering . I know why it happened

R - ggvis - Ordering axis

放肆的年华 提交于 2019-12-11 09:48:22
问题 I'm playing around with ggvis for the first time. I have trouble ordering my X-axis. ggvis tends to order it alphabetically. I would prefer a different order (analyst, consultant, software engineer, manager, director). The code/data looks like this: > str(company$Age) int [1:19] 35 37 30 28 28 27 25 26 25 25 ... > str(company$Role) Factor w/ 5 levels "Analyst","Consultant",..: 3 3 4 4 4 5 2 2 1 1 ... Ggvis code looks like this: company %>% ggvis(~Role,~Age) %>% layer_points() The result is an

ggvis - using a variable to assign “x” property using props

此生再无相见时 提交于 2019-12-11 06:24:58
问题 According to the properties and scales reference and this SO post I should be able to use a props(prop()) call as shown below to create the graph. I'm getting an unintelligible error though. test_df <- data.frame(cbind(x_vals = letters[1:5], y_vals = 1:5)) Graphs correctly: test_df %>% ggvis(x = ~x_vals, y = ~y_vals) %>% layer_points() Has error: x_val_variable <- "x_vals" test_df %>% ggvis(y = ~y_vals) %>% props(prop("x", as.name(x_val_variable)) %>% layer_points() Can anyone help me by

linked_brush in ggvis cannot work in Shiny when data change

自古美人都是妖i 提交于 2019-12-11 02:45:25
问题 I want to create a Shiny APP which uses ggvis to plot a interactive figure and linked_brush to select points in the figure. The plot data are changed according to inputs. But I get an error message when I try to put all thing together. Error : Length of calculated column 'reactive_185425318' (0) is not equal to 1 or the number of rows in data (32). I try to create a minimum example through the "basic" demo in ggvis: ui.R library(ggvis) shinyUI(pageWithSidebar( div(), sidebarPanel( textInput(

reactive updates in shiny app selectInput and radioButtons - ggvis

孤街醉人 提交于 2019-12-11 00:39:53
问题 I try to implement one feature in my simple shiny app. My target is to create reactive widget which will be dependent on different widget. In my example I have two important widgets: radioButtons and selectInput . Depending on what I choose in radioButtons , the output of widget selectInput will be change. Unfortunately I get an error: Error in as.name(input$xvar) :invalid type/length (symbol/0) . Thanks for any help. ui.R library(shiny) shinyUI( fluidPage( fluidRow( column(3, selectInput(