If you want to import your dataset in a format that is more manageable, I suggest you use the jsonlite
package instead. I saved the data you posted in a .txt
file and imported it with the following code. This way you obtain a nice data frame/tibble that you can wrangle to your heart's content:
library(jsonlite)
library(tibble)
json_full <- fromJSON("telegram_text.txt")
dat <- as_tibble(json_full$messages)
dat
# A tibble: 25 x 16
id type date from from_id forwarded_from file thumbnail media_type mime_type duration_seconds width height text photo reply_to_messag~
<int> <chr> <chr> <chr> <dbl> <chr> <chr> <chr> <chr> <chr> <int> <int> <int> <list> <chr> <int>
1 1615952 messa~ 2019-0~ Grace 4.33e9 The Dodo (File not ~ (File not inc~ video_file video/mp4 1181 1280 720 <chr ~ NA NA
2 1615953 messa~ 2019-0~ Grace 4.33e9 NA NA NA NA NA NA NA NA <df[,~ NA NA
3 2259979 messa~ 2020-0~ Dougl~ 4.91e9 NA NA NA NA NA NA 591 1280 <chr ~ (File not ~ NA
4 2259981 messa~ 2020-0~ Dougl~ 4.91e9 NA NA NA NA NA NA 941 1280 <chr ~ (File not ~ NA
5 2259982 messa~ 2020-0~ Dougl~ 4.91e9 NA NA NA NA NA NA NA NA <chr ~ NA NA
6 2259984 messa~ 2020-0~ Dougl~ 4.91e9 NA NA NA NA NA NA NA NA <chr ~ NA NA
7 2259985 messa~ 2020-0~ Dougl~ 4.91e9 NA NA NA NA NA NA NA NA <chr ~ NA NA
8 2259986 messa~ 2020-0~ Dougl~ 4.91e9 NA NA NA NA NA NA NA NA <chr ~ NA NA
9 2259987 messa~ 2020-0~ Grace 4.33e9 NA NA NA NA NA NA NA NA <chr ~ NA NA
10 2259988 messa~ 2020-0~ Dougl~ 4.91e9 NA NA NA NA NA NA NA NA <chr ~ NA NA
# ... with 15 more rows