我试图在sparklyr中使用group_by()和mutate()函数来连接组中的行.
这是一个我认为应该有效的简单示例,但不是:
library(sparkylr)
d <- data.frame(id=c("1", "1", "2", "2", "1", "2"),
x=c("200", "200", "200", "201", "201", "201"),
y=c("This", "That", "The", "Other", "End", "End"))
d_sdf <- copy_to(sc, d, "d")
d_sdf %>% group_by(id, x) %>% mutate( y = paste(y, collapse = " "))
Run Code Online (Sandbox Code Playgroud)
我想要它产生的是:
Source: local data frame [6 x 3]
Groups: id, x [4]
# A tibble: 6 x 3
id x y
<fctr> <fctr> <chr>
1 1 200 This That
2 1 200 This That
3 2 200 The
4 …Run Code Online (Sandbox Code Playgroud) 我正在使用闪亮的演示文稿来显示两个表格。这是我的代码:
tabsetPanel(
tabPanel('iris',
renderDataTable(iris,options =
list(lengthMenu = c(5, 10), pageLength = 5, scrollX = TRUE), escape =
FALSE)),
tabPanel('mtcars',
renderDataTable(mtcars, options = list(lengthMenu
= c(5, 10), pageLength = 5, scrollX = TRUE), escape = FALSE))
)
Run Code Online (Sandbox Code Playgroud)
我想缩小表格的大小。我尝试通过以下方式添加 div:
div(renderDataTable(mtcars, options = list(lengthMenu
= c(5, 10), pageLength = 5, scrollX = TRUE), escape = FALSE), style = "font-
size:50% ")
Run Code Online (Sandbox Code Playgroud)
但这是行不通的。
我也试过这样做:
mainPanel(
tabsetPanel(id='BLMS',
tabPanel("iris", fluidRow(div(dataTableOutput(outputId="iris"),
style = "font-size:50%"))),
tabPanel("mtcars",
fluidRow(div(dataTableOutput(outputId="mtcars"), style = "font-size:50%")))
)
)
output$iris<- renderDataTable({iris}, options = list(lengthMenu …Run Code Online (Sandbox Code Playgroud)