小编Lis*_*els的帖子

R:rJava无法安装在Mac OSX 10.8.5'lzma库丢失'和'libjri.jnilib make error'

使用install.packages("rJava")我安装rJava时会出现几个错误.

lm-mb:~ lisa$ R

R Under development (unstable) (2013-11-21 r64282) -- "Unsuffered Consequences"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin10.8.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to …
Run Code Online (Sandbox Code Playgroud)

java macos r rjava

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

更改 Shiny 中 pickerInput 项目的颜色

在此示例之后,有人可以告诉我是否可能以及如何更改包中pickerInputUI下拉菜单中项目的字体颜色shinyWidgets

这是小部件的一个简短示例:

library("shiny")
library("shinyWidgets")

shinyApp(
  ui = 
    shinyUI(fluidPage(
      sidebarLayout(
        sidebarPanel(
          pickerInput("select", label=NULL,
                      choices=LETTERS,
                      selected = LETTERS,
                      multiple=TRUE, 
                      options = list(
                        `actions-box` = TRUE,
                        size = 10,
                        `selected-text-format` = "count > 3"
                      ))
          ),
        mainPanel())
    )
    ),
  server = function(input, output){}
)
Run Code Online (Sandbox Code Playgroud)
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats4    parallel  stats     graphics  grDevices …
Run Code Online (Sandbox Code Playgroud)

css r shiny

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

删除shinydashboardPlus中右侧栏宽度改变时出现的多余空间

我正在使用shinydashboardPlus并希望更改右侧边栏的宽度,我知道可以通过width在函数调用中指定参数来完成rightSidebar,但是当我这样做时(按照从这里获取的下面的示例),冗余空间出现在右侧菜单(请参阅下面屏幕截图中右侧菜单旁边的深灰色列/空间)。

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyWidgets)

data(iris)
mychoices <- c("pick me A", 
               "pick me - a very long name here", 
               "no pick me - B", 
               "another one that is long")

## my css
CSS <- function(colors){
  template <- "
.checkboxGroupButtons div.btn-group:nth-child(%s) button {
  background: %s !important;
  color: black !important;
  padding: 5px;
  margin-bottom: 8px
}"
  paste0(
    apply(cbind(seq_along(colors), colors), 1, function(vc){
      sprintf(template, vc[1], vc[2])
    }),
    collapse = "\n"
  )
}
cols <- c("red", "blue", "yellow", …
Run Code Online (Sandbox Code Playgroud)

css r shiny shinydashboard

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

如何在 facet_wrap 中使用 label_wrap_gen 和 as_labeller

我有一个分面图,并且想将分面条标题包装在多行上(如果超过一定数量的字符),所以我知道我使用labeller = label_wrap_gen(10)(例如包装超过 10 个字符),这在传递给 时效果很好facet_wrap,但是,我还想传递新标签。我知道我可以labeller = as_labeller(new labels)用来做到这一点。有没有办法一起做?我不想弄乱数据并直接在 data.frame 中重新标记它们(在我自己的情况下是一个小标题)。

下面是一个示例来演示:

data(iris)

## plot iris lengths by species
ggplot(iris, aes(x=Sepal.Length, y=Petal.Length)) + 
  geom_point() + 
  facet_wrap(~Species)

## re-label species names
newLabs <- c(paste("this one is called", levels(iris$Species)))
newLabs <- setNames(newLabs, nm = levels(iris$Species))
ggplot(iris, aes(x=Sepal.Length, y=Petal.Length)) + 
  geom_point() + 
  facet_wrap(~Species, labeller = as_labeller(newLabs))
Run Code Online (Sandbox Code Playgroud)

这产生了这个: 在此处输入图片说明

还使用时如何包装刻面条标题as_labeller

sessionInfo
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

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

更改 R Shiny 中 selectizeInput 选项的颜色

我想更改selectizeInput闪亮应用程序中菜单每个选项的颜色。在下面的示例代码中,我可以将所有菜单选项的颜色更改为蓝色,但如何为每个单独的选项更改颜色?例如,将“a”设为红色,“b”设为蓝色,“c”设为绿色等。

非常感谢!

shinyApp(
  ui = 
    shinyUI(fluidPage(
      tags$head(
        tags$style(HTML("
     .item {
       background: #2196f3 !important;
       color: white !important;
     }
     .selectize-dropdown-content .active {
       background: #2196f3 !important;
       color: white !important;
     }
  "))
      ),
      sidebarLayout(
        sidebarPanel(
          selectizeInput("select", label=NULL,
                         choices=c("a", "b", "c", "d"),
                         selected = c("a", "b", "c", "d"),
                         multiple=TRUE, options=list(placeholder="Wybierz"))),
        mainPanel())
    )
    ),
  server = function(input, output){}
)
Run Code Online (Sandbox Code Playgroud)
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 …
Run Code Online (Sandbox Code Playgroud)

css r shiny shinyapps

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

将文本颜色添加到DT Shiny数据表中的特定列名称(标题)

我对Shiny中的DT相当新,并希望将文本颜色添加到表中的特定列,我可以使用formatStyle下面的示例代码块来执行此操作.但是,我还想将相同的文本颜色添加到相应的列名称(标题),是否有一种简单的方法可以做到这一点?

library(shiny)
library(DT)

ui = fluidPage(DT::dataTableOutput('fDataTable'))

server = function(input, output) {
  output$fDataTable = DT::renderDataTable({
    DT::datatable(iris) %>%
      formatStyle(columns = 1, color = "red") %>%
      formatStyle(columns = 3, color = "blue")
  })
}  

app = list(ui = ui, server = server)
runApp(app)
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激.

shiny dt

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

在 R 中的 ggplot2 中向所有方面添加点的最佳方法

有人可以告诉我将相同的点添加到下面的图的每个方面的最佳方法吗?

例如,在下面,如果我选择标记为“未知”的点之一,我可以geom_point在绘制绘图面后调用,但(因为它被标记为“未知”)它仅在第四个面上突出显示。我想将它添加到每个方面。

## load example iris data
data(iris)

## relabel some points in the data as "unknown"
set.seed(1)
plot_data <- iris
ind <- sample(seq(nrow(iris)), 20)
plot_data$Species <- factor(plot_data$Species, c(levels(plot_data$Species), "unknown"))
plot_data[ind, "Species"] <- "unknown"

## add ids for each point and specifiy colour scheme
plot_data$id <- seq(nrow(plot_data))
cols <- c("pink", "yellow", "blue", "grey")

## make facet plot
g <- ggplot(plot_data, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
  geom_point() +
  scale_color_manual(values = cols) …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

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

标签 统计

r ×6

shiny ×4

css ×3

ggplot2 ×2

dt ×1

java ×1

macos ×1

rjava ×1

shinyapps ×1

shinydashboard ×1