microsoft / datamations

https://microsoft.github.io/datamations/
Other
67 stars 14 forks source link

Some question about R #34

Closed giorgi-ghviniashvili closed 3 years ago

giorgi-ghviniashvili commented 3 years ago

Hi @jhofman and @sharlagelfand , I will ask some questions about R here and if you have some time, please answer.

Some of them might be very dumb , sorry about that ..

giorgi-ghviniashvili commented 3 years ago
jhofman commented 3 years ago
  • what is %>% ?

that is a great question. you can think of it like a unix pipe that passes the output of one command the input of the next. (specifically it passes the output as the first argument of the next command, but you can override that with the dot operator if you like.) more here.

  • where is the entry point of datamations

i'll leave that one for @sharlagelfand.

  • how to run whole R script file into Shiny app without ctrl + enter for each line?

i think you're looking for cmd-shift-return, but see these rstudio keyboard shortcuts

sharlagelfand commented 3 years ago

where is the entry point of datamations

not sure what you mean @giorgi-ghviniashvili, can you clarify?

giorgi-ghviniashvili commented 3 years ago

@jhofman thanks, just tested 1st and 3rd

image

giorgi-ghviniashvili commented 3 years ago

not sure what you mean @giorgi-ghviniashvili, can you clarify?

For example, in js env, we have package.json and there is startup script defined in package.json, was looking forward something like that where the exported functions of datamations reside.

giorgi-ghviniashvili commented 3 years ago

@sharlagelfand my intention is to start reading R and know where to start from..

sharlagelfand commented 3 years ago

hmm I think something similar (from what I just read about package.json) is the DESCRIPTION file, which contains the title, license, people, dependencies, etc. The NAMESPACE file contains the names of all the functions we export, on lines starting with export. The function definitions themselves are in the R/ directory and any documentation is rendered into man/. let me know if i can provide more info!

sharlagelfand commented 3 years ago

@giorgi-ghviniashvili If you want to understand how each of the stages is happening in datamations, I'd look at the code in my refactor-test branch moreso than the main branch, since it has been simplified a fair amount and focuses on generating the coordinates and vegalite specs for each stage, rather than the ggplot2 graphics and GIFs in the main branch.

For example, datamation_sanddance() is the first R function called, and it loops through animate_group_by_sanddance() and animate_summarize_mean_sanddance() to define the stages and specs for each of group_by() and summarize()