You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly, thanks for creating such a cool and powerful library - just discovered it and having a lot of fun with it.
However, I've come across some issues that I can't seem to get around and I'm not sure why my animations aren't rendering or how to get around them. The short of it it, I have a pretty simple and small dataframe that plots just fine on ggplot2, but once I try and animate, I get errors depending on my attempt that's usually in this form:
"Error in rep(seq_len(nrow(polygon)), splits + 1) :
invalid 'times' argument"
And the only way I was able to render it, it was faulty and came up w several warnings about each group consists of only one observation, ultimately looking like this, without the actual line graph:
I'm attaching my (very simple) code here, as well as the data in case you'd like to reproduce yourself. Any thoughts as to why this isn't working? I have some big ideas to use this library for my job, so any help would be hugely appreciated!
btw - I don't understand why this isn't working now as I got it to work before on a different (but pretty similar) data set:
top <- read.csv('top-fundraisers.csv')
#renaming a column, filtering for only US and excluding unnecessary vars
top_us <- top %>% rename(dollars = X.dollars) %>% filter(fundraiser_country == 'US') %>% select(-c(dollars_excl_refund, campaign_id))
#formatting date to date class and extracting year
top_us$creation_date = as.Date(top_us$creation_date, format="%m/%d/%y")
top_us$year = format(top_us$creation_date,"%Y")
#converting the dollars amount from str to numeric
top_us$dollars <- as.numeric(gsub(",","",top_us$dollars))
#extracting top fundraiser by year
top_us_year <- top_us %>% group_by(year) %>% slice_max(order_by = dollars, n = 1) %>% as.data.frame()
###attempt #1
top_g <- ggplot(top_us_year, aes(x = creation_date, y = dollars, group = fundraiser_country)) +
geom_line() + geom_point() + transition_time(creation_date)
animate(top_g)
###ERROR:
#Error in rep(seq_len(nrow(polygon)), splits + 1) :
# invalid 'times' argument
###attempt #2
top_g <- ggplot(top_us_year, aes(x = creation_date, y = dollars, group = fundraiser_country)) +
geom_line(aes(group=creation_date), linetype=1) + geom_point() + transition_time(creation_date)
animate(top_g)
###ERROR:
#geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
# geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
# Rendering [==========================>---------------------------------------------------] at 13 fps ~ eta: 5sgeom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
###attempt #3
top_g <- ggplot(top_us_year, aes(x = year, y = dollars, group = fundraiser_country)) +
geom_line() + geom_point() + transition_states(year)
animate(top_g)
###ERROR:
#Error in rep(seq_len(nrow(polygon)), splits + 1) :
#invalid 'times' argument
###attempt #4
top_g <- ggplot(top_us_year, aes(x = year, y = dollars, group = fundraiser_country)) +
geom_line(aes(group=year)) + geom_point() + transition_states(year)
animate(top_g)
###ERROR:
#Error in `vec_rbind()`:
#! Can't combine `..1$x` <mapped_discrete> and `..2$x` <mapped_discrete>.
#✖ Some attributes are incompatible.
#ℹ The author of the class should implement vctrs methods.
#ℹ See <https://vctrs.r-lib.org/reference/faq-error-incompatible-attributes.html>.
The text was updated successfully, but these errors were encountered:
Hey Thomas,
Firstly, thanks for creating such a cool and powerful library - just discovered it and having a lot of fun with it.
However, I've come across some issues that I can't seem to get around and I'm not sure why my animations aren't rendering or how to get around them. The short of it it, I have a pretty simple and small dataframe that plots just fine on ggplot2, but once I try and animate, I get errors depending on my attempt that's usually in this form:
invalid 'times' argument"
And the only way I was able to render it, it was faulty and came up w several warnings about each group consists of only one observation, ultimately looking like this, without the actual line graph:
I'm attaching my (very simple) code here, as well as the data in case you'd like to reproduce yourself. Any thoughts as to why this isn't working? I have some big ideas to use this library for my job, so any help would be hugely appreciated!
btw - I don't understand why this isn't working now as I got it to work before on a different (but pretty similar) data set:
top-fundraisers.csv
The text was updated successfully, but these errors were encountered: