ggplot problem . "Error unused argument(s) (n)"

2,084 views
Skip to first unread message

Andrew Clark

unread,
Mar 12, 2013, 2:07:08 PM3/12/13
to shiny-...@googlegroups.com
Hi
 Any idea why I would be getting this error on glimmer 
whilst it is not occurring locally?
The files are the same on both and I have updated all packages

Here is relevant code
output$histogram1 <- renderPlot( {
    
     tit <- paste0("Point distribution after ",input$games1," games")

     print(ggplot(subset(tables_dt_print,Pl==input$games1), aes(x=Season, y=Pts)) +
               geom_boxplot()+coord_flip()  +ggtitle("tit") +ylab("Points")+xlab(""))
     })

William Beasley

unread,
Mar 13, 2013, 2:19:06 AM3/13/13
to shiny-...@googlegroups.com
I'm wondering if it might be related to scoping issues.

What happens if you replace
subset(tables_dt_print,Pl==input$games1)
with 
tables_dt_print[tables_dt_print$Pl==input$games1, ]
?

Maybe try using aes_string instead of aes.
Or maybe try defining the data.frame (as its distinct variable) before the call to ggplot.

Andrew Clark

unread,
Mar 13, 2013, 1:51:05 PM3/13/13
to shiny-...@googlegroups.com
William
  Thanks for suggestions all of which I tried unsuccesfully
  Definitely a good practice to create the data.frame in a reactive . I originally wrote this back in the day
and need to tidy up code
  The main issue I have is that it is the same ui,R, global.R and server.R on both the glimmer host
and my local machine and there are no issues on the latter
Andrew

Joe Cheng

unread,
Mar 13, 2013, 2:13:47 PM3/13/13
to shiny-...@googlegroups.com
I copied your files to a different account on Glimmer and it worked fine. I thought maybe you had a different version of some library installed, but I can't seem to find any difference.

Still investigating...


--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Joe Cheng

unread,
Mar 13, 2013, 2:29:19 PM3/13/13
to shiny-...@googlegroups.com
It looks like you have plyr installed in your personal library but not ggplot2. ggplot2 is being taken from the site library (/usr/local/lib/R/site-library) where a version is being loaded that is not compatible with plyr 1.8.

You should either install ggplot2 in your personal library, or remove plyr from your personal library--either should fix it.

Andrew Clark

unread,
Mar 13, 2013, 2:55:31 PM3/13/13
to shiny-...@googlegroups.com
Thanks Joe
 i installed ggplot2 and that seems to have done trick
Just to clarify, in RStudio, clicking on the packages tab gives me a list of the packages on the site library?
Is best practice only to have in personal library those packages that are not already on site library?

Joe Cheng

unread,
Mar 13, 2013, 5:53:03 PM3/13/13
to shiny-...@googlegroups.com
I think the Packages tab gives you all the packages available to you, regardless of which library it comes from.

I don't think we have solidified any best practices yet with regard to package management. I put ggplot in the site library because many of our first users would run into "there is no package called 'ggplot2'" when attempting to write their first apps.
Reply all
Reply to author
Forward
0 new messages