小编Cha*_*rot的帖子

R shinyDashboard自定义框状态颜色

我想自定义我的闪亮应用程序的框状态的颜色.我找到一种css方式来改变这些盒子的盒子背景颜色,但不是自定义状态颜色,但是我没有在css中看到等效的"status"参数?因此,我打印一个包含所考虑的参数"status"的简单页面的源代码,我正在查看它的类(我认为class ="box box-solid box-primary")但我无法在几个中找到它.css在这个网页上提供...... :(

你有好主意吗 ?

这是一个简单的代码:

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    fluidRow(
      box(width = 6, title = "youhou", status = "primary", solidHeader = TRUE,
          "Box content"
      )
    )
    )
    )


server <- function(input, output) {}

shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud)

预先感谢您的任何帮助 !

css r shiny box shinydashboard

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

使用R6类创建和记录软件包

由于使用RStudio,devtools和roxygen2,我目前正在使用R6类创建我的第一个R包(:D)。当我的软件包仅包含函数时,我可以毫无问题地构建和加载它。但是,当我想记录R6类(在此包https://cran.r-project.org/web/packages/data.tree/data.tree.pdf中具有“节点”之类的字段和方法)时,RStudio不会不想构建软件包。我试图在论坛上找到窍门,但是有关此问题的信息很少

我的程序:

  1. 打开Rstudio,创建一个新项目,我选择“ R包”
  2. 我填写了程序包的名称,然后选择了程序包所基于的源文件(一个函数和3个类)。

->至此,程序就可以了,因为我使用“ man”获得了正确的结构,并带有我的不同类的描述,“ R”使用了这些类的不同脚本。

但是,当我尝试构建并重新加载程序包(事先已加载R6程序包)时,出现错误:

==> R CMD INSTALL --no-multiarch --with-keep.source esa

* installing to library ‘/home/cha/R/x86_64-pc-linux-gnu-library/3.0’
* installing *source* package ‘esa’ ...
** R
** preparing package for lazy loading
Error in eval(expr, envir, enclos) :
  impossible de trouver la fonction "R6Class" (translation: impossible to find the function "R6Class")
Error : unable to load R code in package ‘esa’
ERROR: lazy loading failed for package ‘esa’
* removing ‘/home/cha/R/x86_64-pc-linux-gnu-library/3.0/esa’
* restoring previous ‘/home/cha/R/x86_64-pc-linux-gnu-library/3.0/esa’ …
Run Code Online (Sandbox Code Playgroud)

r class rstudio

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

R在背景中添加图像

我尝试使用"plotly"R包在R图形中绘制图像.

我首先尝试从本地计算机中包含一个图像:

library(plotly)

outfile <- tempfile(fileext = ".png")

png(outfile)
plot(rnorm(200), rnorm(200))
dev.off()

plot_ly(x = c(1, 2, 3), y = c(1, 2, 3)) %>%
  layout(
    images = list(
      list(
        source =  outfile,
        xref = "x",
        yref = "y",
        x = 1,
        y = 1,
        sizex = 2,
        sizey = 2,
        sizing = "stretch",
        opacity = 0.4,
        layer = "below"
      )


    )
  )
Run Code Online (Sandbox Code Playgroud)

但我没有设法做到这一点.然后我认为那是因为情节显然需要http或https图像.

第一个问题:是否可以从本地文件导入图像(显然可以使用python:https://plot.ly/python/images/)?

由于似乎无法嵌入本地图像,我尝试导入我在Github上传的图像.但它似乎既不工作:

library(plotly)

plot_ly(x = c(1, 2, 3), y = c(1, 2, 3)) %>% …
Run Code Online (Sandbox Code Playgroud)

plot r image plotly

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

标签 统计

r ×3

box ×1

class ×1

css ×1

image ×1

plot ×1

plotly ×1

rstudio ×1

shiny ×1

shinydashboard ×1