小编San*_*osh的帖子

SQLite选择计数大于1的所有记录

这是我的架构:

create table events(
 event_type integer not null,
 value integer not null,
 time timestamp not null,
 unique (event_type ,time)
);

insert into events values
(2,   5,  '2015-05-09 12:42:00'),
(4, -42,  '2015-05-09 13:19:57'),
(2,   2,  '2015-05-09 14:48:39'),
(2,   7,  '2015-05-09 13:54:39'),
(3,  16,  '2015-05-09 13:19:57'),
(3,  20,  '2015-05-09 15:01:09')   
Run Code Online (Sandbox Code Playgroud)

我想显示所有event_type已多次注册的记录。如您在模式中所看到的,event_type 2 and 3它发生了不止一次。以下是我使用的查询,该查询仅选择一个记录event_type 2 and 3

select event_type, value, time from events
group by event_type
having count(event_type) > 1;
Run Code Online (Sandbox Code Playgroud)

我想查看显示带有的所有记录的查询event_type 2 and 3。在此先感谢您提供的所有帮助。

sqlite

3
推荐指数
1
解决办法
2156
查看次数

在 Shiny 中删除/隐藏滑块输入的小刻度

我希望从sliderInput(). 例如,在 Shiny 应用程序的默认示例 - Old Faithful Geyser Data 中,sliderInput()可以为直方图选择多个 bin。bin 的数量总是整数。因此,最好隐藏/删除小刻度sliderInput()并仅显示箱号的主要刻度。

Shiny 应用程序的默认示例:

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(

   # Application title
   titlePanel("Old Faithful Geyser Data"),

   # Sidebar with a slider input for number of bins 
   sidebarLayout(
      sidebarPanel(
         sliderInput("bins",
                 "Number of bins:",
                 min = 1,
                 max = 10,
                 value = 1)
      ),

     # Show a plot of the generated distribution
     mainPanel(
        plotOutput("distPlot")
     )
  )
)

# …
Run Code Online (Sandbox Code Playgroud)

css r shiny

2
推荐指数
1
解决办法
1391
查看次数

使用R的网络图:基于连接边数的节点大小

我想根据连接边的数量看到节点/顶点的大小.例如,如果节点1与其他节点具有更多数量的连接边,则节点1的大小应更大.我已经采用了一个假设的简单数据和尝试网络图,它运作得相当好.基本上,网络图是关于共同作者网络.但是,我想根据连接边的数量调整节点的大小.另外,我想知道如何自定义边缘颜色?例如,如果节点1具有多于4个连接,则所有4个边缘的颜色应为红色.

以下是表现良好的代码:

library(igraph)

# original data as a list
input_data  = list(c(1,2,3),c(1,4,5),c(1,6),c(3),c(4,6))

## function that makes all pairs
pairing <- function(x) {
  n = length(x)
  if (n<2) {
    res <- NULL
  } else {
  q <- combn(n,2)
  x2 <- x[q]
  #dim(x2) <- dim(q)
  res <- x2
  }
  return(res)
}

## for each paper create all author pairs
pairing_bypaper = lapply(input_data,pairing)

## remove papers that contribute no edges
pair_noedge = sapply(pairing_bypaper,is.null)
pair2_bypaper <- pairing_bypaper[!pair_noedge]

## combine all 'subgraphs'
pair_all <- do.call('c',pair2_bypaper) …
Run Code Online (Sandbox Code Playgroud)

r igraph

1
推荐指数
1
解决办法
3669
查看次数

标签 统计

r ×2

css ×1

igraph ×1

shiny ×1

sqlite ×1