Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.tsv file not generated when using a list as input to animint() #102

Closed
Faye-yufan opened this issue Aug 10, 2023 · 5 comments
Closed

.tsv file not generated when using a list as input to animint() #102

Faye-yufan opened this issue Aug 10, 2023 · 5 comments

Comments

@Faye-yufan
Copy link
Collaborator

Description:

When using the animint() function with internal data, I observed that there are no .tsv data files generated in the specified/temp output directory.
*By 'internal data', I mean the datasets pre-loaded in base package and animint2 package.

Observations:

  1. For the animint() function:

    • No .tsv data files are generated in the output directory, either in temporary directory or specific directory, when using internal datasets (like mtcars in the example).
    library(animint2)
    viz.point <- list(
    pointtwo = ggplot() + geom_point(
    data = mtcars,
    colour="red",
    colour_off="transparent",
    size = 10,
    aes(x=wt, y=mpg,
    fill = disp),
    clickSelects = "gear")+
    ggtitle("colour=\"red\", colour_off=\"transparent\" "))
    
    # both of the below are not working
    animint(viz.point) # the function would generate a temporary directory
    animint(viz.point, out.dir = "/your/dir") # with a specified directory
    • In contrast, external data behaves as expected. An example can be found here, where I used the data from wbstats package and the output utilizes a temporary directory and serves the output with servr.
  2. Now if you try the animint2dir() function with the same viz list above, it seems to compile and render successfully without any issues.

animint2dir(viz.point, out.dir = "/your/dir")
@ampurr
Copy link
Collaborator

ampurr commented Aug 14, 2023

Oo, interesting. I tested it for myself. For some reason, it renders a .tsv file on my end. Here's the code I used:

# Everyone's favorite package
library(animint2)

# So the implicit clickSelects on 
# legends will activate
mtcars$gear <- as.character(mtcars$gear)

# Cars make vroom vroom sounds
# unless they're electric 🚗
vroom <- mtcars |>
  ggplot() +
  geom_point() +
  aes(x = wt, y = mpg,
      group = gear, color = gear)

# This generates both the animint
# and the .tsv file
animint(vroom)

@Faye-yufan
Copy link
Collaborator Author

Oh I see the mix-up now, animint() is looking for ggplot objects and animint2dir() wants a list. My bad! Maybe we should give users a heads up about the input types if no .tsv files were generated?

@tdhock
Copy link
Collaborator

tdhock commented Aug 15, 2023

yes animint(...) arguments should be ggplot objects and options (as documented), this was designed as a substitute for structure(list(...), class="animint").
yes good idea to add an error message in this case.

@Faye-yufan Faye-yufan changed the title Missing .tsv for package internal data when using animint() .tsv file not generated when using a list as input to animint() Aug 15, 2023
@Faye-yufan
Copy link
Collaborator Author

Oops, my bad for missing that in the docs. For reference:

For animint(): here
And for animint2dir(): here

@ampurr
Copy link
Collaborator

ampurr commented Aug 28, 2023

Cars make vroom vroom sounds
unless they're electric 🚗

Apparently electric cars also make vroom vroom sounds. It's like a law thing so hearing people can hear the cars and not get hit. Anyway, just wanted to correct this factual inaccuracy. Thank you. :>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants