ERROR: cannot coerce type 'environment' to vector of type 'character' with ggplot












0















I am attempting to leverage ggplot code found on SO. The problem is i keep getting errors and i think it has something to do with trying to pass the the functions through shinydashboard. I've tried all sorts of things. I can get this to render fine in the console but not in shinydashboard.



 library(shinydashboard)
library(shiny)
library(ggplot2)
library(dplyr)

ui <- fluidPage(
gggauge(52,breaks=c(0,35,70,100)
)

)
server <- function(input, output) {
gggauge <- function(pos,breaks=c(0,30,70,100)) {
get.poly <- function(a,b,r1=0.5,r2=1.0) {
th.start <- pi*(1-a/100)
th.end <- pi*(1-b/100)
th <- seq(th.start,th.end,length=100)
x <- c(r1*cos(th),rev(r2*cos(th)))
y <- c(r1*sin(th),rev(r2*sin(th)))
return(data.frame(x,y))
}
ggplot()+
geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="red")+
geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold")+geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="forestgreen")+
geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y))+
geom_text(data=as.data.frame(breaks), size=5, fontface="bold", vjust=0,
aes(x=1.1*cos(pi*(1-breaks/100)),y=1.1*sin(pi*(1-breaks/100)),label=paste0(breaks,"%")))+
annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
coord_fixed()+
theme_bw()+
theme(axis.text=element_blank(),
axis.title=element_blank(),
axis.ticks=element_blank(),
panel.grid=element_blank(),
panel.border=element_blank())
}
}
shinyApp(ui = ui, server = server)









share|improve this question



























    0















    I am attempting to leverage ggplot code found on SO. The problem is i keep getting errors and i think it has something to do with trying to pass the the functions through shinydashboard. I've tried all sorts of things. I can get this to render fine in the console but not in shinydashboard.



     library(shinydashboard)
    library(shiny)
    library(ggplot2)
    library(dplyr)

    ui <- fluidPage(
    gggauge(52,breaks=c(0,35,70,100)
    )

    )
    server <- function(input, output) {
    gggauge <- function(pos,breaks=c(0,30,70,100)) {
    get.poly <- function(a,b,r1=0.5,r2=1.0) {
    th.start <- pi*(1-a/100)
    th.end <- pi*(1-b/100)
    th <- seq(th.start,th.end,length=100)
    x <- c(r1*cos(th),rev(r2*cos(th)))
    y <- c(r1*sin(th),rev(r2*sin(th)))
    return(data.frame(x,y))
    }
    ggplot()+
    geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="red")+
    geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold")+geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="forestgreen")+
    geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y))+
    geom_text(data=as.data.frame(breaks), size=5, fontface="bold", vjust=0,
    aes(x=1.1*cos(pi*(1-breaks/100)),y=1.1*sin(pi*(1-breaks/100)),label=paste0(breaks,"%")))+
    annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
    coord_fixed()+
    theme_bw()+
    theme(axis.text=element_blank(),
    axis.title=element_blank(),
    axis.ticks=element_blank(),
    panel.grid=element_blank(),
    panel.border=element_blank())
    }
    }
    shinyApp(ui = ui, server = server)









    share|improve this question

























      0












      0








      0








      I am attempting to leverage ggplot code found on SO. The problem is i keep getting errors and i think it has something to do with trying to pass the the functions through shinydashboard. I've tried all sorts of things. I can get this to render fine in the console but not in shinydashboard.



       library(shinydashboard)
      library(shiny)
      library(ggplot2)
      library(dplyr)

      ui <- fluidPage(
      gggauge(52,breaks=c(0,35,70,100)
      )

      )
      server <- function(input, output) {
      gggauge <- function(pos,breaks=c(0,30,70,100)) {
      get.poly <- function(a,b,r1=0.5,r2=1.0) {
      th.start <- pi*(1-a/100)
      th.end <- pi*(1-b/100)
      th <- seq(th.start,th.end,length=100)
      x <- c(r1*cos(th),rev(r2*cos(th)))
      y <- c(r1*sin(th),rev(r2*sin(th)))
      return(data.frame(x,y))
      }
      ggplot()+
      geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="red")+
      geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold")+geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="forestgreen")+
      geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y))+
      geom_text(data=as.data.frame(breaks), size=5, fontface="bold", vjust=0,
      aes(x=1.1*cos(pi*(1-breaks/100)),y=1.1*sin(pi*(1-breaks/100)),label=paste0(breaks,"%")))+
      annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
      coord_fixed()+
      theme_bw()+
      theme(axis.text=element_blank(),
      axis.title=element_blank(),
      axis.ticks=element_blank(),
      panel.grid=element_blank(),
      panel.border=element_blank())
      }
      }
      shinyApp(ui = ui, server = server)









      share|improve this question














      I am attempting to leverage ggplot code found on SO. The problem is i keep getting errors and i think it has something to do with trying to pass the the functions through shinydashboard. I've tried all sorts of things. I can get this to render fine in the console but not in shinydashboard.



       library(shinydashboard)
      library(shiny)
      library(ggplot2)
      library(dplyr)

      ui <- fluidPage(
      gggauge(52,breaks=c(0,35,70,100)
      )

      )
      server <- function(input, output) {
      gggauge <- function(pos,breaks=c(0,30,70,100)) {
      get.poly <- function(a,b,r1=0.5,r2=1.0) {
      th.start <- pi*(1-a/100)
      th.end <- pi*(1-b/100)
      th <- seq(th.start,th.end,length=100)
      x <- c(r1*cos(th),rev(r2*cos(th)))
      y <- c(r1*sin(th),rev(r2*sin(th)))
      return(data.frame(x,y))
      }
      ggplot()+
      geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="red")+
      geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold")+geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="forestgreen")+
      geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y))+
      geom_text(data=as.data.frame(breaks), size=5, fontface="bold", vjust=0,
      aes(x=1.1*cos(pi*(1-breaks/100)),y=1.1*sin(pi*(1-breaks/100)),label=paste0(breaks,"%")))+
      annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
      coord_fixed()+
      theme_bw()+
      theme(axis.text=element_blank(),
      axis.title=element_blank(),
      axis.ticks=element_blank(),
      panel.grid=element_blank(),
      panel.border=element_blank())
      }
      }
      shinyApp(ui = ui, server = server)






      r ggplot2 shiny shinydashboard






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '18 at 20:04









      BasballguyBasballguy

      266




      266
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Use -



          library(shinydashboard)
          library(shiny)
          library(ggplot2)
          library(dplyr)

          gggauge <- function(pos,breaks=c(0,30,70,100)) {
          get.poly <- function(a,b,r1=0.5,r2=1.0) {
          th.start <- pi*(1-a/100)
          th.end <- pi*(1-b/100)
          th <- seq(th.start,th.end,length=100)
          x <- c(r1*cos(th),rev(r2*cos(th)))
          y <- c(r1*sin(th),rev(r2*sin(th)))
          return(data.frame(x,y))
          }
          ggplot()+
          geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="red")+
          geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold")+geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="forestgreen")+
          geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y))+
          geom_text(data=as.data.frame(breaks), size=5, fontface="bold", vjust=0,
          aes(x=1.1*cos(pi*(1-breaks/100)),y=1.1*sin(pi*(1-breaks/100)),label=paste0(breaks,"%")))+
          annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
          coord_fixed()+
          theme_bw()+
          theme(axis.text=element_blank(),
          axis.title=element_blank(),
          axis.ticks=element_blank(),
          panel.grid=element_blank(),
          panel.border=element_blank())
          }

          ui <- fluidPage(

          plotOutput("plot1", click = "plot_click"),
          verbatimTextOutput("info")

          )

          server <- function(input, output) {

          output$plot1 <- renderPlot({
          #plot(mtcars$wt, mtcars$mpg)
          gggauge(52,breaks=c(0,35,70,100))
          })
          }
          shinyApp(ui = ui, server = server)


          Output



          enter image description here



          Explanation



          You mixed up a few things but you were almost there. Everything you need is right here. You just need to organize. Let's go through the components -





          1. gggauge is a function that renders the plot, so it needs to be a function defined separately and called from the server component. Merely defining it in the server object was not enough. In your case the function was getting defined, not called!

          2. The ui component needs a placeholder for rendering a plot. Directly trying to render the plot in ui won't cut it. You just need an plotOutput object there which acts as a placeholder (a UI component)

          3. Now that (1) and (2) are taken care of, its time to render the plot in the server object by calling the gggauge function.


          Hop that helps!






          share|improve this answer


























          • really appreciate the teaching feedback. This structure did the trick and i have a better understanding...simple question i think...why does this function need to be declared outside of server code compared to other functions?

            – Basballguy
            Nov 23 '18 at 22:08











          • @Basballguy just good coding practice to keep it modular. When you will develop more complex apps the server, UI and global files with sit in different script files. Just makes more design sense thats it!

            – Vivek Kalyanarangan
            Nov 23 '18 at 22:12











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452384%2ferror-cannot-coerce-type-environment-to-vector-of-type-character-with-ggplo%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Use -



          library(shinydashboard)
          library(shiny)
          library(ggplot2)
          library(dplyr)

          gggauge <- function(pos,breaks=c(0,30,70,100)) {
          get.poly <- function(a,b,r1=0.5,r2=1.0) {
          th.start <- pi*(1-a/100)
          th.end <- pi*(1-b/100)
          th <- seq(th.start,th.end,length=100)
          x <- c(r1*cos(th),rev(r2*cos(th)))
          y <- c(r1*sin(th),rev(r2*sin(th)))
          return(data.frame(x,y))
          }
          ggplot()+
          geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="red")+
          geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold")+geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="forestgreen")+
          geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y))+
          geom_text(data=as.data.frame(breaks), size=5, fontface="bold", vjust=0,
          aes(x=1.1*cos(pi*(1-breaks/100)),y=1.1*sin(pi*(1-breaks/100)),label=paste0(breaks,"%")))+
          annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
          coord_fixed()+
          theme_bw()+
          theme(axis.text=element_blank(),
          axis.title=element_blank(),
          axis.ticks=element_blank(),
          panel.grid=element_blank(),
          panel.border=element_blank())
          }

          ui <- fluidPage(

          plotOutput("plot1", click = "plot_click"),
          verbatimTextOutput("info")

          )

          server <- function(input, output) {

          output$plot1 <- renderPlot({
          #plot(mtcars$wt, mtcars$mpg)
          gggauge(52,breaks=c(0,35,70,100))
          })
          }
          shinyApp(ui = ui, server = server)


          Output



          enter image description here



          Explanation



          You mixed up a few things but you were almost there. Everything you need is right here. You just need to organize. Let's go through the components -





          1. gggauge is a function that renders the plot, so it needs to be a function defined separately and called from the server component. Merely defining it in the server object was not enough. In your case the function was getting defined, not called!

          2. The ui component needs a placeholder for rendering a plot. Directly trying to render the plot in ui won't cut it. You just need an plotOutput object there which acts as a placeholder (a UI component)

          3. Now that (1) and (2) are taken care of, its time to render the plot in the server object by calling the gggauge function.


          Hop that helps!






          share|improve this answer


























          • really appreciate the teaching feedback. This structure did the trick and i have a better understanding...simple question i think...why does this function need to be declared outside of server code compared to other functions?

            – Basballguy
            Nov 23 '18 at 22:08











          • @Basballguy just good coding practice to keep it modular. When you will develop more complex apps the server, UI and global files with sit in different script files. Just makes more design sense thats it!

            – Vivek Kalyanarangan
            Nov 23 '18 at 22:12
















          0














          Use -



          library(shinydashboard)
          library(shiny)
          library(ggplot2)
          library(dplyr)

          gggauge <- function(pos,breaks=c(0,30,70,100)) {
          get.poly <- function(a,b,r1=0.5,r2=1.0) {
          th.start <- pi*(1-a/100)
          th.end <- pi*(1-b/100)
          th <- seq(th.start,th.end,length=100)
          x <- c(r1*cos(th),rev(r2*cos(th)))
          y <- c(r1*sin(th),rev(r2*sin(th)))
          return(data.frame(x,y))
          }
          ggplot()+
          geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="red")+
          geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold")+geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="forestgreen")+
          geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y))+
          geom_text(data=as.data.frame(breaks), size=5, fontface="bold", vjust=0,
          aes(x=1.1*cos(pi*(1-breaks/100)),y=1.1*sin(pi*(1-breaks/100)),label=paste0(breaks,"%")))+
          annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
          coord_fixed()+
          theme_bw()+
          theme(axis.text=element_blank(),
          axis.title=element_blank(),
          axis.ticks=element_blank(),
          panel.grid=element_blank(),
          panel.border=element_blank())
          }

          ui <- fluidPage(

          plotOutput("plot1", click = "plot_click"),
          verbatimTextOutput("info")

          )

          server <- function(input, output) {

          output$plot1 <- renderPlot({
          #plot(mtcars$wt, mtcars$mpg)
          gggauge(52,breaks=c(0,35,70,100))
          })
          }
          shinyApp(ui = ui, server = server)


          Output



          enter image description here



          Explanation



          You mixed up a few things but you were almost there. Everything you need is right here. You just need to organize. Let's go through the components -





          1. gggauge is a function that renders the plot, so it needs to be a function defined separately and called from the server component. Merely defining it in the server object was not enough. In your case the function was getting defined, not called!

          2. The ui component needs a placeholder for rendering a plot. Directly trying to render the plot in ui won't cut it. You just need an plotOutput object there which acts as a placeholder (a UI component)

          3. Now that (1) and (2) are taken care of, its time to render the plot in the server object by calling the gggauge function.


          Hop that helps!






          share|improve this answer


























          • really appreciate the teaching feedback. This structure did the trick and i have a better understanding...simple question i think...why does this function need to be declared outside of server code compared to other functions?

            – Basballguy
            Nov 23 '18 at 22:08











          • @Basballguy just good coding practice to keep it modular. When you will develop more complex apps the server, UI and global files with sit in different script files. Just makes more design sense thats it!

            – Vivek Kalyanarangan
            Nov 23 '18 at 22:12














          0












          0








          0







          Use -



          library(shinydashboard)
          library(shiny)
          library(ggplot2)
          library(dplyr)

          gggauge <- function(pos,breaks=c(0,30,70,100)) {
          get.poly <- function(a,b,r1=0.5,r2=1.0) {
          th.start <- pi*(1-a/100)
          th.end <- pi*(1-b/100)
          th <- seq(th.start,th.end,length=100)
          x <- c(r1*cos(th),rev(r2*cos(th)))
          y <- c(r1*sin(th),rev(r2*sin(th)))
          return(data.frame(x,y))
          }
          ggplot()+
          geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="red")+
          geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold")+geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="forestgreen")+
          geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y))+
          geom_text(data=as.data.frame(breaks), size=5, fontface="bold", vjust=0,
          aes(x=1.1*cos(pi*(1-breaks/100)),y=1.1*sin(pi*(1-breaks/100)),label=paste0(breaks,"%")))+
          annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
          coord_fixed()+
          theme_bw()+
          theme(axis.text=element_blank(),
          axis.title=element_blank(),
          axis.ticks=element_blank(),
          panel.grid=element_blank(),
          panel.border=element_blank())
          }

          ui <- fluidPage(

          plotOutput("plot1", click = "plot_click"),
          verbatimTextOutput("info")

          )

          server <- function(input, output) {

          output$plot1 <- renderPlot({
          #plot(mtcars$wt, mtcars$mpg)
          gggauge(52,breaks=c(0,35,70,100))
          })
          }
          shinyApp(ui = ui, server = server)


          Output



          enter image description here



          Explanation



          You mixed up a few things but you were almost there. Everything you need is right here. You just need to organize. Let's go through the components -





          1. gggauge is a function that renders the plot, so it needs to be a function defined separately and called from the server component. Merely defining it in the server object was not enough. In your case the function was getting defined, not called!

          2. The ui component needs a placeholder for rendering a plot. Directly trying to render the plot in ui won't cut it. You just need an plotOutput object there which acts as a placeholder (a UI component)

          3. Now that (1) and (2) are taken care of, its time to render the plot in the server object by calling the gggauge function.


          Hop that helps!






          share|improve this answer















          Use -



          library(shinydashboard)
          library(shiny)
          library(ggplot2)
          library(dplyr)

          gggauge <- function(pos,breaks=c(0,30,70,100)) {
          get.poly <- function(a,b,r1=0.5,r2=1.0) {
          th.start <- pi*(1-a/100)
          th.end <- pi*(1-b/100)
          th <- seq(th.start,th.end,length=100)
          x <- c(r1*cos(th),rev(r2*cos(th)))
          y <- c(r1*sin(th),rev(r2*sin(th)))
          return(data.frame(x,y))
          }
          ggplot()+
          geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="red")+
          geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold")+geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="forestgreen")+
          geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y))+
          geom_text(data=as.data.frame(breaks), size=5, fontface="bold", vjust=0,
          aes(x=1.1*cos(pi*(1-breaks/100)),y=1.1*sin(pi*(1-breaks/100)),label=paste0(breaks,"%")))+
          annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
          coord_fixed()+
          theme_bw()+
          theme(axis.text=element_blank(),
          axis.title=element_blank(),
          axis.ticks=element_blank(),
          panel.grid=element_blank(),
          panel.border=element_blank())
          }

          ui <- fluidPage(

          plotOutput("plot1", click = "plot_click"),
          verbatimTextOutput("info")

          )

          server <- function(input, output) {

          output$plot1 <- renderPlot({
          #plot(mtcars$wt, mtcars$mpg)
          gggauge(52,breaks=c(0,35,70,100))
          })
          }
          shinyApp(ui = ui, server = server)


          Output



          enter image description here



          Explanation



          You mixed up a few things but you were almost there. Everything you need is right here. You just need to organize. Let's go through the components -





          1. gggauge is a function that renders the plot, so it needs to be a function defined separately and called from the server component. Merely defining it in the server object was not enough. In your case the function was getting defined, not called!

          2. The ui component needs a placeholder for rendering a plot. Directly trying to render the plot in ui won't cut it. You just need an plotOutput object there which acts as a placeholder (a UI component)

          3. Now that (1) and (2) are taken care of, its time to render the plot in the server object by calling the gggauge function.


          Hop that helps!







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 23 '18 at 20:18

























          answered Nov 23 '18 at 20:12









          Vivek KalyanaranganVivek Kalyanarangan

          5,1311828




          5,1311828













          • really appreciate the teaching feedback. This structure did the trick and i have a better understanding...simple question i think...why does this function need to be declared outside of server code compared to other functions?

            – Basballguy
            Nov 23 '18 at 22:08











          • @Basballguy just good coding practice to keep it modular. When you will develop more complex apps the server, UI and global files with sit in different script files. Just makes more design sense thats it!

            – Vivek Kalyanarangan
            Nov 23 '18 at 22:12



















          • really appreciate the teaching feedback. This structure did the trick and i have a better understanding...simple question i think...why does this function need to be declared outside of server code compared to other functions?

            – Basballguy
            Nov 23 '18 at 22:08











          • @Basballguy just good coding practice to keep it modular. When you will develop more complex apps the server, UI and global files with sit in different script files. Just makes more design sense thats it!

            – Vivek Kalyanarangan
            Nov 23 '18 at 22:12

















          really appreciate the teaching feedback. This structure did the trick and i have a better understanding...simple question i think...why does this function need to be declared outside of server code compared to other functions?

          – Basballguy
          Nov 23 '18 at 22:08





          really appreciate the teaching feedback. This structure did the trick and i have a better understanding...simple question i think...why does this function need to be declared outside of server code compared to other functions?

          – Basballguy
          Nov 23 '18 at 22:08













          @Basballguy just good coding practice to keep it modular. When you will develop more complex apps the server, UI and global files with sit in different script files. Just makes more design sense thats it!

          – Vivek Kalyanarangan
          Nov 23 '18 at 22:12





          @Basballguy just good coding practice to keep it modular. When you will develop more complex apps the server, UI and global files with sit in different script files. Just makes more design sense thats it!

          – Vivek Kalyanarangan
          Nov 23 '18 at 22:12




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452384%2ferror-cannot-coerce-type-environment-to-vector-of-type-character-with-ggplo%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin