Giter VIP home page Giter VIP logo

m_r's Issues

CVirus: Aggregation tableau

Salut @lenacoic,
T'as rajouté des notes sur ton app shiny et puis ce que je te propose pour gérer les dates du coup c'est le code suivant:

T_cas %>% 
  select(-c(1:4)) %>% #uniquement les dates
  replace(is.na(.), 0) %>% #car sum donne NA si NA présent
  summarise_all(funs(sum)) %>% #somme de toutes les lignes
  gather(key = "Date") %>% #transposition de la table
  mutate(Date = as.Date(Date,format="%m/%d/%y")) #conversion en date

Ce qui donne quelque chose comme ça

# A tibble: 33 x 2
   Date       value
   <date>     <dbl>
 1 2020-01-22   555
 2 2020-01-23   653
 3 2020-01-24   941
 4 2020-01-25  1434
 5 2020-01-26  2118
 6 2020-01-27  2927
 7 2020-01-28  5578
 8 2020-01-29  6166
 9 2020-01-30  8234
10 2020-01-31  9927
# ... with 23 more rows

Et avec ça tu peux faire un bon ggplot() + aes(x = Date, y = value) + geom_line() si tu veux faire un ggplot par exemple.

Après c'est encore perfectible 😅

Bien sûr tu peux mettre tout ça dans une fonction qui prend en argument la table à traiter du coup (dans le code j'ai mis T_cas) car le reste du code est valable pour toutes les tables. Et quand tu fais tes plots, tu pourras choisir les labels (cas, morts...) en fonction de la table choisie.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.