我试图在不同的面板中绘制动态图,因为它可以在网站上使用,group例如
但它应该是动态的使用dygraphs.这里的示例代码:
library(quantmod)
library(dygraphs)
data(edhec)
R = edhec[, 1:4]
dygraph(R)
Run Code Online (Sandbox Code Playgroud)
提前谢谢了.
我想在添加新内容时将滚动条保留在底部。
printText <- function() {
for(i in 1:20){
Sys.sleep(0.1)
shinyjs::html("text", paste("My text", i, "<br>"), add = TRUE)
y = i + 1
}
return(y)
}
library(shiny)
library(shinyjs)
runApp(list(
ui = shinyUI(fluidPage(
shinyjs::useShinyjs(),
titlePanel("Print consol output"),
sidebarLayout(
sidebarPanel(actionButton("go", "Go")),
mainPanel(
style = "overflow-y:scroll; max-height: 100px; position:relative;",
div(id = "text")
)
)
)),
server = shinyServer(function(input, output, session){
observeEvent(input$go, {
shinyjs::html("text", "")
y <- printText()
})
})
))
Run Code Online (Sandbox Code Playgroud)
我找到了调用 javascript 的相关解决方案,但它在我的情况下不起作用。
这是js代码:
function scrollToBottom(){
var elem = document.getElementById('text');
elem.scrollTop = elem.scrollHeight;
}; …Run Code Online (Sandbox Code Playgroud) 我正在构建一个应用程序,允许用户从中传递值selectizeInput或checkboxInput形成数据帧.我搜索了一段时间,发现这些来源与我的期望相似:
它来自这里:https://github.com/jrowen/rhandsontable.我非常类似于这个例子:
shiny::runGitHub("jrowen/rhandsontable",
subdir = "inst/examples/rhandsontable_portfolio")
Run Code Online (Sandbox Code Playgroud)
但我想使用闪亮的小部件将值传递给数据帧.它应该能够添加/删除行,如下例所示:
代码在这里:
library("shiny")
library('devtools')
install_github('shiny-incubator', 'rstudio')
library("shinyIncubator")
# initialize data with colnames
df <- data.frame(matrix(c("0","0"), 1, 2))
colnames(df) <- c("Input1", "Input2")
server = shinyServer(
function(input, output) {
# table of outputs
output$table.output <- renderTable(
{ res <- matrix(apply(input$data,1,prod))
res <- do.call(cbind, list(input$data, res))
colnames(res) <- c("Input 1","Input 2","Product")
res
}
, include.rownames = FALSE
, include.colnames = TRUE
, align = "cccc"
, digits …Run Code Online (Sandbox Code Playgroud) 我正在尝试测试 9*9 数独问题的有效性,结果应通过printk(KERN_INFO "blablabla"). 我尝试了两种方法来编译我的 c 文件,make以及gcc myfile.c myfile -o -lpthread. 然而,他们都没有工作。
当我调用make它时,它抛出了一个致命错误: pthread.h: no such file or directory but it is right in the path /usr/include。
然后我从网上找到了一些建议,所以我gcc这次尝试了。不幸的是,我在调用后遇到了一堆错误,gcc myfile.c myfile -o -lpthread例如
/usr/include/linux/list.h: In function 'INIT_LIST_HEAD': /usr/include/linux/list.h:27:17: error: dereferencing pointer to incomplete type 'struct list_head'
和
error: unknown type name 'bool',
这仅仅是列举的一小部分。问题的关键是,我得到了这些错误后,我通过我的升级软件sudo apt-get update -y。
这是代码:
#include <pthread.h>
#include <linux/module.h>
#include <linux/kernel.h> …Run Code Online (Sandbox Code Playgroud)