JBGruber/rwhatsapp

Uploading WhatsApp data to Shiny

Closed this issue · 4 comments

Hi, I am creating an App where a User can upload data to Shiny. I have tried researching on how I can do that but I always get an error.

Warning in rwhatsapp::rwa_read(input$file$datapath) :
Time conversion did not work correctly. Provide a custom format or add an issue at www.github.com/JBGruber/rwhatsapp.
Warning: Error in is.finite: default method not implemented for type 'list'
108: formatC
106: print.xtable
97: transform
96: func
94: f
93: Reduce
84: do
83: hybrid_chain
82: origRenderFunc
81: output$head
1: runApp

What could be the issue, or how can I go about it.

This error usually indicates that the time in your file is provided in an unsupported format. I'm adding new formats as I discover them, so if you send me 3-4 lines from your file I can probably do that quickly.

I don't think the Shiny part should cause any trouble but you should try to read the file normally first anyway.

  time author text source id emoji emoji_name
1 6/8/2020 21:52 NA Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more. D:\Work\My_Proj\R Proj\Sentiment\Data\Nyandarua\Githioro_1st_parliament.txt 1    

I believe I have found out where the issue was. I need to first upload it as a normal txt, then read it using rwa_read. The time periods is in 24 hrs, but is datetime format as you will see in the poreview.

You can also pass the text directly to rwhatsapp. Would that solve your problem?

library(rwhatsapp)
history <- system.file("extdata", "sample.txt", package = "rwhatsapp")
lines <- readLines(history)
rwa_read(lines)
#> # A tibble: 9 x 6
#>   time                author    text                    source emoji  emoji_name
#>   <dttm>              <fct>     <chr>                   <chr>  <list> <list>    
#> 1 2017-07-12 22:35:17 <NA>      "Messages to this grou… text … <NULL> <NULL>    
#> 2 2017-07-12 22:35:17 <NA>      "You created group \"T… text … <NULL> <NULL>    
#> 3 2017-07-12 22:35:17 Johannes… "<Media omitted>"       text … <NULL> <NULL>    
#> 4 2017-07-12 22:35:17 Johannes… "Fruit bread with ched… text … <chr … <chr [2]> 
#> 5 2017-07-13 09:12:17 Test      "It's fun doing text a… text … <NULL> <NULL>    
#> 6 2017-07-13 09:16:17 Johannes… "Haha it sure is 😅"    text … <chr … <chr [1]> 
#> 7 2018-09-28 13:27:17 Johannes… "Did you know there is… text … <NULL> <NULL>    
#> 8 2018-09-28 13:28:17 Johannes… "😀😃😄😁😆😅😂🤣☺😊😇🙂🙃😉😌😍😘😗😙😚😋… text … <chr … <chr [242…
#> 9 2018-09-28 13:30:17 Johannes… "🤷‍♀🤷🏻‍♂🙎‍♀🙎‍♂🙍‍♀🙍‍♂💇‍…        text … <chr … <chr [87]>

Created on 2020-12-01 by the reprex package (v0.3.0)

Since I haven't heard anything in a while, I'm closing this. Let me know if you need further help.