小编Eri*_*ung的帖子

r - 如何在多个面板中绘制dygraphs

我试图在不同的面板中绘制动态图,因为它可以在网站上使用,group例如在此输入图像描述

但它应该是动态的使用dygraphs.这里的示例代码:

library(quantmod)
library(dygraphs)
data(edhec)
R = edhec[, 1:4]
dygraph(R)
Run Code Online (Sandbox Code Playgroud)

提前谢谢了.

css r dygraphs

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

r - 如何自动滚动到闪亮应用程序中 div 的底部?

我想在添加新内容时将滚动条保留在底部。

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)

javascript css r shiny

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

r - 用户通过闪亮输入值到数据帧

我正在构建一个应用程序,允许用户从中传递值selectizeInputcheckboxInput形成数据帧.我搜索了一段时间,发现这些来源与我的期望相似:

  1. handsontable

它来自这里:https://github.com/jrowen/rhandsontable.我非常类似于这个例子:

shiny::runGitHub("jrowen/rhandsontable",
                 subdir = "inst/examples/rhandsontable_portfolio")
Run Code Online (Sandbox Code Playgroud)

但我想使用闪亮的小部件将值传递给数据帧.它应该能够添加/删除行,如下例所示:

  1. shinyIncubator

代码在这里:

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)

r shiny

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

c、linux——在内核中使用pthread.h

我正在尝试测试 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)

c linux pthreads

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

标签 统计

r ×3

css ×2

shiny ×2

c ×1

dygraphs ×1

javascript ×1

linux ×1

pthreads ×1