# Cannot find function animation\_opts

**URL:** <https://community.plotly.com/t/cannot-find-function-animation-opts/3197>\
**Category:** Plotly R\
**Created:** [January 26, 2017, 7:55pm UTC](https://community.plotly.com/t/cannot-find-function-animation-opts/3197 "2017-01-26T19:55:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiroshial](https://avatars.discourse-cdn.com/v4/letter/h/f19dbf/32.png) [@hiroshial](https://community.plotly.com/u/hiroshial)\
**Post date:** [January 26, 2017, 7:55pm UTC](https://community.plotly.com/t/cannot-find-function-animation-opts/3197/1 "2017-01-26T19:55:02Z")

</div>

Hi all,

I am trying the code on the instruction page for animation view, however it give me this error: Error in function\_list[i] :  
could not find function “animation\_opts”

Does anyone know how to access function? is there any other package i should download?

Thanks!!

Here is the code I copied from the webpage.

library(plotly)  
library(ggplot2)

data(gapminder, package = “gapminder”)  
gg \<- ggplot(gapminder, aes(gdpPercap, lifeExp)) +  
geom\_point(aes(size = pop, color = continent)) +  
scale\_x\_log10()  
ggplotly§

base \<- gapminder %\>%  
plot\_ly(x = ~gdpPercap, y = ~lifeExp, size = ~pop, text = ~country, hoverinfo = “text”) %\>%  
layout(xaxis = list(type = “log”))

base %\>%  
add\_markers(color = ~continent, frame = ~year, ids = ~country) %\>%  
animation\_opts(1000, easing = “elastic”) %\>%  
animation\_button(x = 1, xanchor = “right”, y = 0, yanchor = “bottom”) %\>%  
animation\_slider(currentvalue = list(prefix = "YEAR ", font = list(color = “red”)))

---

<div class="post-metadata">

**Author:** ![bcd](https://avatars.discourse-cdn.com/v4/letter/b/ec9cab/32.png) [@bcd](https://community.plotly.com/u/bcd)\
**Post date:** [January 27, 2017, 2:17pm UTC](https://community.plotly.com/t/cannot-find-function-animation-opts/3197/2 "2017-01-27T14:17:56Z")

</div>

Hey @hiroshial,

try installing the development version `devtools::install_github(“ropensci/plotly”)`

---

<div class="post-metadata">

**Author:** ![hiroshial](https://avatars.discourse-cdn.com/v4/letter/h/f19dbf/32.png) [@hiroshial](https://community.plotly.com/u/hiroshial)\
**Post date:** [January 27, 2017, 4:09pm UTC](https://community.plotly.com/t/cannot-find-function-animation-opts/3197/3 "2017-01-27T16:09:44Z")

</div>

Thanks! i tried! it works now!.. and i forget to upddate my R too (Now it is 3.3.2)… but i still have problem running the instruction code in the guid book:

base %\>%  
add\_markers(color = ~continent, frame = ~year, ids = ~country) %\>%  
animation\_opts(1000, easing = “elastic”) %\>%  
animation\_button(x = 1, xanchor = “right”, y = 0, yanchor = “bottom”) %\>%  
animation\_slider(currentvalue = list(prefix = "YEAR ", font = list(color = “red”)))

It is " animation\_button(x = 1, xanchor = “right”, y = 0, yanchor = “bottom”) %\>%" cause the problem:  
Error in p$x$layout$updatemenus[[which(isAniButton)]] :  
attempt to select less than one element in get1index

do you know how to fix this ?

great thanks!

---

<div class="post-metadata">

**Author:** ![C4ADSdata](https://avatars.discourse-cdn.com/v4/letter/c/a88e4f/32.png) [@C4ADSdata](https://community.plotly.com/u/C4ADSdata)\
**Post date:** [February 9, 2017, 9:33pm UTC](https://community.plotly.com/t/cannot-find-function-animation-opts/3197/4 "2017-02-09T21:33:36Z")

</div>

I’m having the same issue. When I try to install the development version with the code: `devtools::install_github(“ropensci/plotly”)` I get the error:

```
Downloading GitHub repo ropensci/plotly@master
from URL https://api.github.com/repos/ropensci/plotly/zipball/master
Error in curl::curl_fetch_memory(url, handle = handle) : 
Couldn't resolve host name
```

---

<div class="post-metadata">

**Author:** ![hiroshial](https://avatars.discourse-cdn.com/v4/letter/h/f19dbf/32.png) [@hiroshial](https://community.plotly.com/u/hiroshial)\
**Post date:** [February 15, 2017, 7:55pm UTC](https://community.plotly.com/t/cannot-find-function-animation-opts/3197/5 "2017-02-15T19:55:16Z")

</div>

I resolved by first, you have to connect with the host:  
First, run this code:  
Sys.setenv(“plotly\_username”=“YOUR USER NAME”) ## modife your user name to your username  
Sys.setenv(“plotly\_api\_key”=“YOUR API KEY”) ## find your api key in your profile

Second, run the development version code:  
devtools::install\_github(“ropensci/plotly”)

Make sure your R is updated and also your Rstudio is updated. Plotly has some issues in R 3.2.x

Hope it helps

Hiroshial
