library(shiny)
library(GPArotation)
library(ggplot2)
shinyServer(function(input, output) {
# full_ess <- haven::read_sav("~/Dropbox/DOCs/кафедра/Анализ и визуализация в R/R2018-2019/data/ESS7e02_1.sav")
# PT.values <- full_ess[full_ess$cntry=="PT",c("ipcrtiv", "imprich", "ipeqopt", "ipshabt", "impsafe",
# "impdiff", "ipfrule", "ipudrst", "ipmodst", "ipgdtim", "impfree")]
# save(PT.values, file="PT.values.Rdata")
load(file="PT.values.Rdata")
output$fact.plot <- renderPlot({
fa <- factanal(factors = input$nfactors,
covmat = cov(na.omit(PT.values)),
rotation = input$rot.method
)
tbl <- as.data.frame(fa$loadings[,1:2])
tbl$indicator <- rownames(tbl)
ggplot(tbl, aes(Factor1, Factor2, label=indicator))+geom_label()
})
})
library(shiny)
shinyUI(fluidPage(
# Application title
titlePanel("Dependence of factor loadings on rotation method"),
sidebarLayout(
sidebarPanel(
sliderInput("nfactors",
"Number of factors:",
min = 1,
max = 6,
value = 2),
selectInput(inputId = "rot.method",
label = "Rotation method",
choices = c("none", "Varimax", "geominQ", "infomaxT", "oblimin"),
selected = "none"
)
),
mainPanel(
plotOutput("fact.plot")
)
)
))