Ggplotly giving error: unused argument (<environment>)

When I run ggplotly, it gives me the error:

Error in f(..., self = self) : unused argument (<environment>)

Then after I run the code I can’t plot anything in R. I try to rerun and plot the same graph and nothing happens. The system won’t plot until I restart R.

Example code:


df <- data.frame(
  gp = factor(rep(letters[1:3], each = 10)),
  y = rnorm(30, mean = 5)
ds <- plyr::ddply(df, "gp", plyr::summarise, mean = mean(y), sd = sd(y))

gg <- ggplot(df, aes(gp, y)) +
  geom_point() +
  geom_point(data = ds, aes(y = mean), colour = 'red', size = 3)


> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] plotly_4.5.6       ggplot2_2.2.1.9000

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.9       tidyr_0.6.1       viridisLite_0.1.3 digest_0.6.12     dplyr_0.5.0      
 [6] assertthat_0.1    grid_3.3.2        plyr_1.8.4        R6_2.2.0          jsonlite_1.2     
[11] gtable_0.2.0      DBI_0.5-1         magrittr_1.5      scales_0.4.1      httr_1.2.1       
[16] lazyeval_0.2.0    labeling_0.3      tools_3.3.2       htmlwidgets_0.8   purrr_0.2.2      
[21] munsell_0.4.3     base64enc_0.1-3   colorspace_1.3-2  htmltools_0.3.5   tibble_1.2       
> globalenv()
<environment: R_GlobalEnv>

Hey @C4ADSdata

This seems to work fine for me with plotly_4.5.6.9000. Try installing the development version devtools::install_github('ropensci/plotly)

1 Like

I suspected it might be something wrong with my computer or some bug in my Rstudio. It’s a strange issue I couldn’t find anywhere else on the internet. Thank you for running the code for me!