아래 예제에서 webplot() 대신 chartJSRadar()를 사용하고 싶습니다. 가능한가? webplot()의 기능을 모르지만이 장소에서 레이더 차트를 사용해야합니다. 이 기능의 사용은 33 줄로 시작됩니다. 코드는 여기에서 찾을 수 있습니다 : https://gist.github.com/mbannert/9124890/반짝이는 ChartJS 레이더 플롯을 사용하는 방법
data_sets <- c("mtcars")
shinyServer(function(input, output) {
# Drop-down selection box for which data set
output$choose_dataset <- renderUI({
selectInput("dataset", "Data set", as.list(data_sets))
})
# select a car
output$choose_car <- renderUI({
selectInput("car","car",as.list(rownames(get(input$dataset))))
})
# Check boxes
output$choose_columns <- renderUI({
# If missing input, return to avoid error later in function
if(is.null(input$dataset))
return()
# Get the data set with the appropriate name
dat <- get(input$dataset)
colnames <- names(dat)
# Create the checkboxes and select them all by default
checkboxGroupInput("columns", "Choose columns",
choices = colnames,
selected = colnames)
})
output$radar <- renderPlot({
source("radar.R")
webplot(get(input$dataset),
which(rownames(mtcars) == input$car), y.cols = input$columns,add=F)
})
# Output the data
output$data_table <- renderTable({
# If missing input, return to avoid error later in function
if(is.null(input$dataset))
return()
# Get the data set
dat <- get(input$dataset)
# Make sure columns are correct for data set (when data set changes, the
# columns will initially be for the previous data set)
if (is.null(input$columns) || !(input$columns %in% names(dat)))
return()
# Keep the selected columns
dat <- dat[, input$columns, drop = FALSE]
# Return first 20 rows
head(dat, 20)
})
})
shinyUI(pageWithSidebar(
headerPanel("Car Comparison Radar"),
sidebarPanel(
uiOutput("choose_dataset"),
uiOutput("choose_car"),
uiOutput("choose_columns"),
br(),
a(href = "http://statisticstoproveanything.blogspot.de/2013/11/spider-web-plots-in-r.html",
"Radar by Alan Vaughn from statisticstoproveanything"),
br(),
a(href = "https://gist.github.com/mbannert/9124890/",
"Find the shiny code gist here.")
),
mainPanel(
plotOutput(outputId = "radar", height = "600px"),
tableOutput("data_table")
)
))
불행하게도, chartjs 패키지 내 일에, 최신없는 나는 레이더 도표 패키지를 사용해야합니다, 당신은 그것을 다시 할 수 있습니까? – Kim
아래에 radarchart 패키지를 사용하는 새로운 대답이 추가되었습니다. 설명서가 업데이트되지는 않았지만 chartjs를 고수 할 것입니다. 훨씬 좋아 보인다. 그런 이유로 나는 두 가지 대답을 모두 남겨 둘 것입니다. – IanK