Android数据绑定

时间:2019-02-08 06:03:44

标签: android kotlin

如何为布尔类型的Observable Field设置默认值

@Bindable
    var buttonEnabled: ObservableField<Boolean> = ObservableField()

1 个答案:

答案 0 :(得分:1)

欢迎使用stackoverflow,您可以将其设置如下:

install.packages("mediation")
library(mediation)    
data(Cars93,package="MASS")

mediator <- c("Weight", "Width", "Length")
outcome <- c("Price", "EngineSize")
kolumns <- c("outcome", "mediator", "effect", "sig")


MED = data.frame (matrix(nrow = length(mediator)*length(outcome), ncol = length(kolumns)))
names (MED) = kolumns
MED$outcome = rep(outcome, each=length(mediator))
MED$mediator = rep(mediator, times=length(outcome))


for (i in mediator)
{ for (j in outcome)
{ 
  model.Y <- lm(Cars93[ ,j] ~ Cars93$Origin + Cars93[, i], data=Cars93)
  model.M <- lm(Cars93[, i] ~ Cars93$Origin, data=Cars93)

  results <- mediate(model.M, model.Y, treat= Cars93$Origin, mediator= Cars93[,i],
                     boot=F, sims=100, dropobs = T)

  MED[MED$outcome ==j & MED$mediator ==i, "effect"] = 
    summary(results)$d.avg
  MED[MED$outcome ==j & MED$mediator ==i, "sig"] = 
    summary(results)$d.avg.p

}
}

默认情况下为假。