如何在R中的嵌套列表中删除以下data.frames列的属性?
List of 1
$ 0021400001:List of 19
$ GameSummary :'data.frame': 1 obs. of 13 variables:
$ GAME_DATE_EST : Factor w/ 1 level "2014-11-09T00:00:00": 1
- attr(*, "names")= chr "1"
$ GAME_SEQUENCE : Factor w/ 1 level "2": 1
- attr(*, "names")= chr "2"
$ GAME_ID : Factor w/ 1 level "0021400091": 1
- attr(*, "names")= chr "3"
$ GAME_STATUS_ID : Factor w/ 1 level "3": 1
- attr(*, "names")= chr "4"
$ SeasonSeries :'data.frame': 1 obs. of 7 variables: …
Run Code Online (Sandbox Code Playgroud) 如何使用复选框从数据框或表中选择数据行?我已经完成了以下代码,但似乎复选框项目是列,并没有真正显示结果.
谢谢你的帮助.
shinyServer(function(input, output) {
dataset<-reactive({
data(cars)
cars
})
output$choose_data <- renderUI({
checkboxGroupInput("dtab", "Data Table", dataset())
})
dataset2<-reactive({
input$dtab
})
output$data_table <- renderTable({
data2()
})
})
Run Code Online (Sandbox Code Playgroud)
shinyUI(pageWithSidebar(
headerPanel(""),
sidebarPanel(
uiOutput("choose_data"),
br()
),
mainPanel(
wellPanel("Data", tableOutput("data_table")
))))
Run Code Online (Sandbox Code Playgroud) 我有以下数据框p3:
test result
1 1 26.87778
2 1 24.52598
3 1 24.02202
4 1 20.32632
5 1 22.00618
6 2 19.84013
7 2 19.68983
8 2 19.84013
9 2 19.23892
10 2 19.23892
11 3 34.36430
12 3 33.28196
13 3 33.82313
14 3 33.82313
15 3 32.47020
16 4 25.55169
17 4 26.90442
18 4 25.40138
19 4 24.19895
20 4 25.85230
21 4 25.70199
22 4 24.95047
23 5 18.64646
24 5 18.64646
25 5 17.80653
26 5 …
Run Code Online (Sandbox Code Playgroud) 我有以下data.frame
df = structure(list(HEADER = c("HOME_TRPM", "AWAY_TRPM", "HOME_TEAM","AWAY_TEAM"),
price = c("0.863104076023855", "-0.845186446996287","CHA", "NOP")),
.Names = c("HEADER", "price"), row.names = c(NA, 4L), class = "data.frame")
df
#> HEADER price
#> 1 HOME_TRPM 0.863104076023855
#> 2 AWAY_TRPM -0.845186446996287
#> 3 HOME_TEAM CHA
#> 4 AWAY_TEAM NOP
Run Code Online (Sandbox Code Playgroud)
我想要转置.如何在不使用t()的情况下在dplyr中执行此操作?我试过了
df %>% tidyr::spread(HEADER , price)
Run Code Online (Sandbox Code Playgroud)
但它不会给出扁平结构,而是这样做:
structure(list(AWAY_TEAM = c(NA, NA, NA, "NOP"),
AWAY_TRPM = c(NA, "-0.845186446996287", NA, NA),
HOME_TEAM = c(NA, NA, "CHA", NA),
HOME_TRPM = c("0.863104076023855", NA, NA, NA)),
.Names = c("AWAY_TEAM", "AWAY_TRPM", "HOME_TEAM", …
Run Code Online (Sandbox Code Playgroud) 我有以下数据
GT-BU7867-09
GT-BU6523-113
GT-BU6452-1
GT-BU8921-12
Run Code Online (Sandbox Code Playgroud)
如何使用R来使连字符后面的数字填充前导零,以便它有三位数?生成的格式应如下所示:
GT-BU7867-009
GT-BU6523-113
GT-BU6452-001
GT-BU8921-012
Run Code Online (Sandbox Code Playgroud) 我有以下数据作为示例:
basketball = c("MISS W. Johnson 18' Pullup Jump Shot",
"MISS Barnes 12' Pullup Jump Shot",
"MISS Carter 19' Pullup Jump Shot")
Run Code Online (Sandbox Code Playgroud)
我如何找到最常见的单词或"相交"它们,以便我只能得到"MISS Pullup Jump Shot"
结果?
如何在Perl中获取对象的数据结构?
我可以使用str轻松地在R中执行此操作
str(data)
Run Code Online (Sandbox Code Playgroud)
我想知道Perl中是否有类似的.
如何合并data.frames中的data.frame和重叠间隔?
read.table(textConnection(
" from to Lith Form
1 0 1.2 GRN BCM
2 1.2 5.0 GDI BDI
"), header=TRUE)
Run Code Online (Sandbox Code Playgroud)
read.table(textConnection(
" from to Weath Str
1 0 1.1 HW ES
2 1.1 2.9 SW VS
3 2.9 5.0 HW ST
"), header=TRUE)
Run Code Online (Sandbox Code Playgroud)
from to Weath Str Lith Form
1 0.0 1.1 HW ES GRN BCM
2 1.1 1.2 SW VS GRN BCM
3 1.2 2.9 SW VS GDI BDI
4 2.9 5.0 HW ST GDI BDI
Run Code Online (Sandbox Code Playgroud) 如何根据间隔剪切两个数据帧并合并它们?
read.table(textConnection(
" from to Lith
1 0 1.2 GRN
2 1.2 5.0 GDI
"), header=TRUE)
Run Code Online (Sandbox Code Playgroud)
read.table(textConnection(
" from to Weath
1 0 1.1 HW
2 1.1 2.9 SW
3 2.9 5.0 HW
"), header=TRUE)
Run Code Online (Sandbox Code Playgroud)
from to Weath Lith
1 0.0 1.1 HW GRN
2 1.1 1.2 SW GRN
3 1.2 2.9 SW GDI
4 2.9 5.0 HW GDI
Run Code Online (Sandbox Code Playgroud)