作为更大的Shiny应用程序的一部分,我正在为用户提交的数据构建一个标签,该标签将替换Excel工作表。基本上,要做到这一点,我需要允许用户从下拉菜单中选择值,而使用Rhandsontable则很容易:
rhandsontable(DF_Adt, height = 200) %>%
hot_table(highlightCol = FALSE, highlightRow = TRUE, width = 600)%>%
hot_col(col = "Serious_Oversight", type = "dropdown", source = so, allowInvalid = FALSE)%>%
hot_col(col = "Header_Detail", type = "dropdown", source = hd, allowInvalid = FALSE)%>%
hot_col(col = "Parts_Labor_Decision", type = "dropdown", source = pld, allowInvalid = FALSE)%>%
hot_col(col = "CCC", type = "dropdown", source = ccc, allowInvalid = FALSE)%>%
hot_col(col = "VSRs", type = "dropdown", source = vsrs, allowInvalid = FALSE)%>%
hot_col(col = "Processor_Message", type = "dropdown", source = pm, allowInvalid = FALSE)
在这里,事情变得更加复杂,我迷路了。我需要根据下拉列表中的选择分配数值,然后有条件地求和。显然,当下拉选项更改时,等效数值必须更新。在Excel中,这很容易:
=IF(E2="","",IF(E2<>"OK",0.5,0.5+0.1*(F2="OK")+0.1*(G2="OK")+0.1*(H2="OK")+0.1*(I2="OK")+0.1*(J2="OK")))
给我们我们想要的东西:
Audit date Claim No Claim Processed By Audited By Serious Oversight Header/Detail Parts Labor Decision CCC VSR's Processor message Quality Score (Automatic Calculation)
6-19-2019 1111 person other person OK OK OK OK OK OK 1
6-19-2019 2222 person other person Not Warrantable OK OK OK OK OK 0.5
6-19-2019 3333 person other person OK Failure Mode OK OK OK OK 0.9
我真的很想像以前一样进行操作,即在没有actionButton的情况下自动更新,但是现在我可以接受任何操作。