- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经编写了用于生成网络图的 UI、服务器和 global.r。它适用于一种布局(layout.fruchterman.reingold)。我想要一个用于列出布局的单选按钮(径向、对角线网络和 dendroNetwork):
Global.R file for producing the graph
### Social Network Analysis /Word Network ##########
###############################################################
tdm <- TermDocumentMatrix(r_stats_text_corpus,control = list(wordLenghts = c(1,Inf)))
idx <- which(dimnames(tdm)$Terms == "call") ##change the terms to be searched
tdm2 <- removeSparseTerms(tdm, sparse = 0.994)
m2 <- as.matrix(tdm2)
m2[m2>=1] <- 1
m2 <- m2 %*% t(m2) ##Adjaceny Matrix
g <- graph.adjacency(m2, weighted=T, mode = "undirected")
g <- simplify(g)
V(g)$label <- V(g)$name
V(g)$degree <- degree(g)
set.seed(3952)
layout1 <- layout.fruchterman.reingold(g)
###Different Formats for Social Network Graphics
##Radial
radial <- as.radialNetwork(fit)
radialNetwork(radial)
#Diagonal Network
diagonalNetwork(radial, height = NULL, width = NULL, fontSize = 10,fontFamily = "serif", linkColour = "#ccc", nodeColour = "#fff",nodeStroke = "steelblue", textColour = "#111", opacity = 0.9,margin = NULL)
#Dendro Network
dendroNetwork(fit, height = 500, width = 1000, fontSize = 10,
linkColour = "#ccc", nodeColour = "#fff", nodeStroke = "steelblue",
textColour = "#111", textOpacity = 0.9, textRotate = NULL,
opacity = 0.9, margins = NULL, linkType = c("elbow", "diagonal"),
treeOrientation = c("horizontal", "vertical"), zoom = TRUE)
Here is how my server.R looks for just the graph section
output$sna <- renderPlot({
plot(g, layout=layout1)
})
And the user interface ui.r is as below
conditionalPanel(condition="input.tabselected==10",radioButtons("layout","Select the layout to be plotted",c("layout.fruchterman.reingold","kawai","graph_net","radialNetwork","dendroNetwork","diagonal Network")))
head(data1,18) 1 "Call of star wars a halos destiny"
[2] "I thought of an new call of duty name CALL OF DUTY: The road of ARK GIANT"
[3] "Activision must be destroyed for the sake of video games. Boycott those pieces of shits."
[4] "FuturisticðŸ˜"
[5] "1:09 is that the XM 53"
[6] "Lets just not..."
[7] "Petition to call next CoD \"Space Cadets: Fanny Warfare\""
[8] "This is just pathetic...."
[9] "BLEAH"
[10] "I hate treyark now for the Campaign ending"
[11] "this isn't a cod trailer"
[12] "It's actually a good game just because you don't get to stand on solid ground 24/7 doesn't mean you have to cry about it, if you don't like the game then go play something else not rage about it to Activision, and do us a favor and go back to World at War please."
[13] "AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHahahahahahahahahahah! Oh, my God, I'm sorry sorry, I, it's just.... AHAHAHAHAHAHAHAHAHAHAHAHahahahah! Canada builds wall! AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH!!! REALLY!?!?! AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH!" [14] "I like the last r seconds the best"
[15] "i love this game"
[16] "what jungle? lol"
[17] "Rated A for aMatures"
[18] "Phelps?"
最佳答案
我不得不承认我发现这是一个引人入胜的话题和一个好主意。您将大部分代码放在一起 - 只需进行很少的更改,我就可以使用它。然后我优化了一点以反射(reflect)输入依赖关系 - 即添加 reactive
职能。
此外,我认为您在这里并不真正想要单选按钮,您真正想要的是选项卡。所以我把它放在一起 - 添加一个也可以将它们一起显示的选项卡:
### Social Network Analysis /Word Network ##########
###############################################################
library(shiny)
library(NLP)
library(tm)
library(igraph)
library(networkD3)
w <- "240px"
h <- "240px"
u <- shinyUI(fluidPage(
titlePanel("NLP Graphs"),
sidebarLayout(
position = "left",
sidebarPanel(
h2("Controls"),
sliderInput("sparse", "Sparsity:", 0.9, 1, 0.994,0.002),
numericInput("fmrseed", "F-R Seed:", 1234, 1, 10000, 1)
),
mainPanel(
h2("Network Graphs"),
tabsetPanel(
tabPanel("Fruchterman-Reingold", plotOutput("fmr")),
tabPanel("Dendro", dendroNetworkOutput("dendro")),
tabPanel("Diagonal", diagonalNetworkOutput("diagonal")),
tabPanel("Radial",radialNetworkOutput("radial")),
tabPanel("All",
fluidRow(column(width=6,h3("FMR",align="center"),plotOutput("fmr1")),
column(width=6,h3("Dendro",align="center"),dendroNetworkOutput("dendro1",width=w,height=h))),
fluidRow(column(width=6,h3("Diagonal",align="center"),diagonalNetworkOutput("diagonal1",width=w,height=h)),
column(width=6,h3("Radial",align="center"),radialNetworkOutput("radial1",width=w,height=h)))
)
)
)
))
)
data <- c(
"Call of star wars a halos destiny",
"I thought of an new call of duty name CALL OF DUTY: The road of ARK GIANT",
"Activision must be destroyed for the sake of video games. Boycott those pieces of shits.",
"Futuristicð",
"1:09 is that the XM 53",
"Lets just not...",
"Petition to call next CoD \"Space Cadets: Fanny Warfare\"",
"This is just pathetic....",
"BLEAH",
"I hate treyark now for the Campaign ending",
"this isn't a cod trailer",
"It's actually a good game just because you don't get to stand on solid ground 24/7 doesn't mean you have to cry about it, if you don't like the game then go play something else not rage about it to Activision, and do us a favor and go back to World at War please.",
"AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHahahahahahahahahahah! Oh, my God, I'm sorry sorry, I, it's just.... AHAHAHAHAHAHAHAHAHAHAHAHahahahah! Canada builds wall! AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH!!! REALLY!?!?! AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH!",
"I like the last r seconds the best",
"i love this game",
"what jungle? lol",
"Rated A for aMatures",
"Phelps?"
)
s <- shinyServer(
function(input, output)
{
r_stats_text_corpus <- Corpus(VectorSource(data))
matadj <- reactive({
tdm <-TermDocumentMatrix(r_stats_text_corpus, control = list(wordLenghts = c(1, Inf)))
idx <-which(dimnames(tdm)$Terms == "call") ##change the terms to be searched
tdm2 <- removeSparseTerms(tdm, sparse = input$sparse)
m2 <- as.matrix(tdm2)
m2[m2 >= 1] <- 1
m2 <- m2 %*% t(m2) ##Adjaceny Matrix - how often words co-occur in a sentence
m2
})
fit <- reactive({
fit <- hclust(dist(matadj()))
})
fmrlayout <- reactive({
set.seed(input$fmrseed)
g <- graph.adjacency(matadj(), weighted = T, mode = "undirected")
g <- simplify(g)
V(g)$label <- V(g)$name
V(g)$degree <- degree(g)
layout <- layout.fruchterman.reingold(g)
rv <- list()
rv$g <- g
rv$layout <- layout
rv
})
radialnet <- reactive({
set.seed(input$fmrseed)
radial <- as.radialNetwork(fit())
})
###Different Social Network Graphics
#Radial Network
output$radial <- renderRadialNetwork({
radialNetwork(radialnet())
})
output$radial1 <- renderRadialNetwork({
radialNetwork(radialnet())
})
#Diagonal Network
output$diagonal <- renderDiagonalNetwork({
diagonalNetwork(
radialnet(),
height = NULL,
width = NULL,
fontSize = 10,
fontFamily = "serif",
linkColour = "#ccc",
nodeColour = "#fff",
nodeStroke = "steelblue",
textColour = "#111",
opacity = 0.9,
margin = NULL
)
})
output$diagonal1 <- renderDiagonalNetwork({
diagonalNetwork(
radialnet(),
height = NULL,
width = NULL,
fontSize = 10,
fontFamily = "serif",
linkColour = "#ccc",
nodeColour = "#fff",
nodeStroke = "steelblue",
textColour = "#111",
opacity = 0.9,
margin = NULL
)
})
#Dendro Network
output$dendro <- renderDendroNetwork({
dendroNetwork(
fit(),
height = 500,
width = 1000,
fontSize = 10,
linkColour = "#ccc",
nodeColour = "#fff",
nodeStroke = "steelblue",
textColour = "#111",
textOpacity = 0.9,
textRotate = NULL,
opacity = 0.9,
margins = NULL,
linkType = c("elbow", "diagonal"),
treeOrientation = c("horizontal", "vertical"),
zoom = TRUE
)
})
output$dendro1 <- renderDendroNetwork({
dendroNetwork(
fit(),
height = 500,
width = 1000,
fontSize = 10,
linkColour = "#ccc",
nodeColour = "#fff",
nodeStroke = "steelblue",
textColour = "#111",
textOpacity = 0.9,
textRotate = NULL,
opacity = 0.9,
margins = NULL,
linkType = c("elbow","diagonal"),
treeOrientation = c("horizontal","vertical"),
zoom = TRUE
)
})
# Fruchterman-Reingold Network
output$fmr <- renderPlot({
rv <- fmrlayout()
plot(rv$g, layout = rv$layout)
})
output$fmr1 <- renderPlot({
rv <- fmrlayout()
plot(rv$g, layout = rv$layout)
})
}
)
shinyApp(ui = u,server = s)
关于r - 我想要一个用于列出布局的单选按钮(径向、对角线网络和 dendroNetwork),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41385314/
HTML 部分,只是我代码的一部分: HP: SP: EA: ED: PA: PD:
我有这个简单的脚本。我正在尝试获取选中的值并将它们添加到禁用输入框中的运行总计中。我知道它正在被选中,但它没有更新到输入框,我不确定为什么。谁能帮帮我? function updateF
我在使用自定义背景的单选按钮/复选框时遇到了问题。我在这里设计了它们的样式:Quick Tip: Easy CSS3 Checkboxes and Radio Buttons .主要部分是input在
我可以预见地读取 jQueryUI 单选按钮的值,但是,我无法以编程方式设置它。无论我使用哪种方法更改单选按钮的值,jQueryUI 界面都不会更新其界面。 Yes No
没有展开时 点击展开之后 <div class="flashread_item_box_time"> <span class="
这里是 JQuery 新手。 我有一个大约有 16 个字段的搜索表单,其中大部分是文本框。其余的都是下拉菜单。我在这些字段下方有 3 个单选按钮。当选择第一个时,表单中的某些字段应被禁用。当选择第二个
我目前正在构建一个 Fiori 应用程序用于查看事件(票证)。我必须创建一个饼图,其中包含票证的所有不同状态。当我单击图表的一部分时,它会将我带到包含该状态的所有票证的列表。我可以选择饼图的多个状态,
此代码将在使用 reloadData 刷新 UITableView 后恢复单元格选择: NSIndexPath *selectedIndexPath = [self.tableView indexPa
我正在尝试对 UITableView 单元格进行自定义选择。为此,我在我的单元格上方创建了 UIView,它现在在触摸时出现/消失。但问题是当我按下单元格选择时出现。如果那时我选择任何其他行,它也会被
我所有的复选框、单选框和文本输入都在 ID 的末尾附加了“_boom”。我想抓取这些 id 的页面,检测更改以查看其中是否有任何一个与其原始状态不同,如果是,则将 CSS 应用于页面上名为“保存”的按
我正在寻找一种方法,使多选列表框应显示为普通的单选组合框,但在单击时它应作为允许多选的列表框,如下所示,如电子表格中所示。我正在寻找 CSS HTML 和 javascript 而非 Jquery 中
我有一个 HTML 我想显示为“列表框”(一个同时显示多个元素的框,而不是下拉框)。但是,我只想允许选择一个元素。我还想将盒子的高度(通过 CSS)设置为其容器大小的 100%。 这三件事似乎是相互排
我有一个包含三个部分的付款表格。基本上,第一个是带有乘数的“单选”列表,第二个是带有设置值的“复选框”列表,第三个是带有乘数的下拉列表 ==> (jsfiddle) .为清楚起见,我插入了一个文本框来
我想删除单选按钮,只显示是或否标签。为此,我隐藏了 radio 输入并使用 css3 选择器 (:checked + label) 根据选择更改背景颜色。但由于某种原因,这不起作用。 HTML(来自
我正在使用这个插件http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/#single对于多选,并且希望也可以在同一
我收到了这段代码,但我似乎无法正常工作,我查看了之前的问题,但找不到任何与之完全相同的代码。也许这完全是错误的,应该重新开始? 我想要做的是在选择单选按钮时显示一个 div。这是我的代码: jQue
我试图在用户点击输入(单选、复选框或选择)时移除焦点背景,但它不起作用。这些是我放在元素上的样式: .form-holder input[type="radio"]:focus, .form-
我正在使用 Bootstrap 4 并想使用单选按钮和复选框按钮组,但按钮显示的是实际的单选按钮和复选框 UI 元素,如下所示: 上面的例子直接摘自文档。我试过删除并重新安装 Bootstrap 4,
我正在使用 Collection View 进行水平滚动。它工作得很好。现在我想为选择任何单元格设置任何效果。所以,我写了这段代码” func collectionView(collectionVi
我有一个按钮组,其中包含必须充当单选按钮的几个项目。我还需要将它们分成几行并跨越容器的整个宽度。 为此,我使用了 Bootstrap 的类 btn-group-justified ,然后我拆分 元素分
我是一名优秀的程序员,十分优秀!