我正在拟合几个模型,并使用plot_models 函数使用 sjPlot 包绘制它们。我只想绘制一些系数并对它们重新排序以便更容易解释。然而,我在第二期遇到了麻烦。
我已经尝试过 order.terms 但仅适用于plot_model,auto.label=FALSE 但只是删除所有标签...
fit1<- glm(y ~ x1*var1 + var2 + var3, data=mydata, family = poisson)
fit2<- glm(y ~ x2*var1 + var2 + var3, data=CARMA_all, family = poisson)
fit3<- glm(y ~ x3*var1 + var2 + var3, data=CARMA_all, family = poisson)
plot_models(fit1,fit2,fit3, m.labels = c("x1", "x2", "x3"),show.values =T,digits=3, show.p = FALSE, p.shape = TRUE, rm.terms = c("var1,"var2","var3"),vline.color="grey",grid.breaks=c(0.95,0.96,0.97,0.98,0.99,1,1.01,1.02,1.03,1.04,1.05), colors = "Dark2")
Run Code Online (Sandbox Code Playgroud)
当我绘制此图时,我首先在图中估计 var1:x3,然后是 x3,然后是 var1:x2, x2, var1:x1, x1。我需要重新排序以获得 x1, var1:x1, x2, var1:x2, x3, var1:x3
我想在一个闪亮的应用程序中包含一个图像.我想:"如果它是类型1情节"这个图像",如果它是0型情节"这个其他图像".我知道我必须将jpg文件放入app.R所在的文件夹然后调用它但是我不知道怎么做.
这是我到目前为止使用的代码(它可以工作),我只需要在渲染中包含图像.
library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Myapp"),
#Inputs
dateInput(inputId = "dob", label="Birth"),
dateInput(inputId = "ad", label="Date"),
actionButton("Submit", icon("fas fa-magic"), label="Submit"),
#Outputs
textOutput(outputId = "textR"),
imageOutput(outputId = "imageR1"),
imageOutput(outputId="imageR2")
)
# Define server logic required to draw a histogram
server <- function(input, output) {
#my output should be named textR and imageR1, imageR2
observeEvent(input$Submit,
output$textR<-renderText({
v1<-as.numeric(as.Date(input$ad,format="%Y/%m/%d") - as.Date(input$dob, format="%Y/%m/%d"))/30.5
value_v1<-ifelse(v1>48, "type1", "type2")
print(value_v1)
}))
}
# Run the application …Run Code Online (Sandbox Code Playgroud)