简体   繁体   English

运行应用程序时出现闪亮错误:match.arg(position) 中的错误:'arg' 必须为 NULL 或字符向量

[英]Shiny Error when running App: Error in match.arg(position) : 'arg' must be NULL or a character vector

I keep getting the error "Error in match.arg(position) : 'arg' must be NULL or a character vector" when trying to run my shiny app.尝试运行我的闪亮应用程序时,我不断收到错误“match.arg(position) 中的错误:'arg' 必须为 NULL 或字符向量”。 I read and reread my code and I can't seem to find an issue.我反复阅读我的代码,但似乎找不到问题。 I also have no idea whether this issue is in my ui code or server code.我也不知道这个问题是在我的 ui 代码还是服务器代码中。 Can anyone spot what I'm missing?谁能发现我错过了什么?

Here's my ui logic:这是我的用户界面逻辑:

library(rtweet)
library(tidytext)
library(tidyverse)
library(stringr)
library(shiny)
library(DT)
library(markdown)
library(shinythemes)

source("R_rainclouds.R")


#create variables for ggplot
joined_names_tweets <- read_rds("joined_names_tweets.rds")
tweets <- read_rds("tweets.rds")


ui <- navbarPage("Project",
                 theme = shinytheme("united"),

     ###########
     ###DATA###
     ##########

           tabPanel("Graphics",
                    tabsetPanel(
                      tabPanel("Over Time",
                               sidebarPanel(
                                 selectInput("screen_name", "NCAA Twitter Accounts:",
                                             choices = joined_names_tweets$screen_name),
                                 mainPanel(plotOutput("raincloud")))),
                      tabPanel("Stuff"))),

    #############
    ##EXPLORE###
    ############

           tabPanel("Explore",

                    fluidPage(
                      titlePanel("Explore the data"),

                      sidebarLayout(
                        sidebarPanel(
                          helpText("Pick an NCAA Twitter Account to view recent tweets"),
                          h3("Tweet Search"),
                          selectInput("screen_name", NULL,
                                      choices = tweets$screen_name,
                                      selected = "@NCAA")),
                        mainPanel(
                          DTOutput("word_table")),
    ##########
    ##ABOUT##
    #########
                    tabPanel("About",
                    fluidRow(
                        column(8,
                               includeMarkdown("about.Rmd"))))))))

and here's my server logic:这是我的服务器逻辑:

server <- function(input, output, session) {

  ########
  ##DATA##
  ########

  output$raincloud <- renderPlot({

    data <- joined_names_tweets %>%
      filter(screen_name == input$screen_name) %>% 

      ggplot(aes(x=sex_id,y=created_at, fill = sex_id)) +
      geom_flat_violin(position = position_nudge(x = .2, y = 0),adjust = 4) +
      geom_point(position = position_jitter(width = .15), size = .25, alpha = .5) +
      ylab('Date')+
      xlab('Gender')+
      coord_flip()+
      theme_cowplot()+
      guides(fill = FALSE) +
      scale_fill_manual(values = c("snow1", "steelblue"))
  })


  ############
  ##EXPLORE##
  ###########

  output$word_table <- renderDT({

    datatable(tweets %>% filter(screen_name == input$screen_name) %>% select(-screen_name),
              class = 'display',
              rownames = FALSE,
              selection = 'single',
              colnames = c("Tweet Text", "Date", "Favorites", "Retweets"),
              options = list(dom = 'tip'))
  })

}


# Run the application 
shinyApp(ui = ui, server = server)

I believe your issue is in your UI If you notice the sidebarLayout function has four arguments and tabPanel is not of them.我相信您的问题出在您的UI如果您注意到sidebarLayout函数有四个参数而tabPanel不属于其中。 You currently have sidebarPanel and mainPanel but then have another tabPanel before closing the sidebarLayout .您目前有sidebarPanelmainPanel但在关闭sidebarLayout之前还有另一个tabPanel

If you delete the tabPanel you should be able to get it to work.如果您删除 tabPanel,您应该能够让它工作。

You can read a little more on this other question to get a better idea of what I mean.您可以阅读有关其他问题的更多信息,以更好地了解我的意思。

shiny Error in match.arg(position) : 'arg' must be NULL or a character vector match.arg(position) 中的闪亮错误:“arg”必须为 NULL 或字符向量

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Shiny 应用程序中的“match.arg(position) 错误:‘arg’必须为 NULL 或字符向量” - "Error in match.arg(position) : 'arg' must be NULL or a character vector" in Shiny app match.arg(position) 中的闪亮错误:“arg”必须为 NULL 或字符向量 - shiny Error in match.arg(position) : 'arg' must be NULL or a character vector 警告:match.arg中的错误:&#39;arg&#39;必须为NULL或字符向量 - Warning: Error in match.arg: 'arg' must be NULL or a character vector match.arg(regions) 中的错误:“arg”必须为 NULL 或字符向量 - Error in match.arg(regions) : 'arg' must be NULL or a character vector match.arg(opt_crit)中的错误:“ arg”必须为NULL或字符向量 - Error in match.arg(opt_crit) : 'arg' must be NULL or a character vector match.arg(p.adjust.method)中的错误:“ arg”必须为NULL或字符向量 - Error in match.arg(p.adjust.method) : 'arg' must be NULL or a character vector 尝试运行以下代码中的插补函数时,“match.arg(what) 中的错误:&#39;arg&#39; 必须为 NULL 或字符向量” - "Error in match.arg(what) : 'arg' must be NULL or a character vector" when trying to run the impute function in the below code match.arg(mvnTest)中的错误:“ arg”的长度必须为1 - Error in match.arg(mvnTest) : 'arg' must be of length 1 对多个 arguments 使用 match.arg 时出错 - Error in using match.arg for multiple arguments Rigraph degree()&#39;match.arg中的错误&#39; - R igraph degree() 'Error in match.arg'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM