0

I am running the example code for the Slider function (example 2) in R:https://plot.ly/r/animations/

I want to simply reproduce the given example.

However, the graph doesn't show up in my viewer.

This is the codeI run in R:

 library(plotly)
library(gapminder)

p <- gapminder %>%
  plot_ly(
    x = ~gdpPercap, 
    y = ~lifeExp, 
    size = ~pop, 
    color = ~continent, 
    frame = ~year, 
    text = ~country, 
    hoverinfo = "text",
    type = 'scatter',
    mode = 'markers'
  ) %>%
  layout(
    xaxis = list(
      type = "log"
    )
  )

I didn't change it from the way it is described here.

Can one help me and tell me why the graph doesn't show up?

2
  • 2
    just type p at the console/command prompt. You're assigning your plot to object p but then you have to explicitly call it to display a prompt, analogous to print(p) Commented May 1, 2019 at 19:38
  • Hi @infominer that helped - thanks for helping me R newbie :) Commented May 2, 2019 at 7:31

1 Answer 1

1

I tried to run the code at start without success as well. Basically the issue was :

Evaluation error: `as_dictionary()` is defunct as of rlang 0.3.0 Please use `as_data_pronoun()` instead.

I think you just need to update your dplyr to the latest version 0.7.7.

install.packages("dplyr") #or update current version

Also check that :

  • Any package larger than a few Kb gives the message:
  Warning in install.packages :

unable to move temporary installation ‘C:\Users[myname]\R\win-library\3.4\file2b884fc37c13\packagename’ to ‘C:\Users[myname]\R\win-library\3.4\packagename’

  • If so,Type in : trace(utils:::unpackPkgZip,edit = T)
    and edited Line 140 Sys.sleep(0.5) to Sys.sleep(2).

Then you can Run your code and print p
Check out the plot

btw a real cool one !

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.