1
我有這樣的代碼,在RStudio 正常工作,但我不會在這個閃亮的 as.datatable()的光澤與renderFormattable不起作用[R formattable數據表,以閃亮的
它說:「因爲沒有適用的方法「爲.htmlwidget」施加到類的對象 「C( '數據表', 'htmlwidget')」,」
server.R輸出$數據< -renderFormattable({
df1<-merge(happiness5[,c(1,3)],
happiness6[,c(1,3)],
by.x = "Country",
by.y = "Country")
colnames(df1)<-c("Country","Happiness Rank 2015","Happiness Rank 2016")
df1<-df1%>%
mutate(`Rank Change`=`Happiness Rank 2015`-`Happiness Rank 2016`)
formattable(df1,list(
`Rank Change` = formatter(
"span",
style=~formattable::style(color=ifelse(`Rank Change`>0,"green","red")))))%>%
as.datatable()
},env = parent.frame(), quoted = FALSE)