The GoT challenge

Aperta
#254 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
r
Ambito
data

Direzione di ricerca

Start with data-raw/got_pov-chars-wrangle.R, especially the linked lines using as_xml_document(), and reproduce the Root nodes must be of length 1 error with the shown pipeline. Compare the generated result with the existing inst/extdata/got_chars.xml; done means the package data can be regenerated with current xml2 functions or the relevant bug or documentation gap is identified.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

help wanted :heart: tidy-dev-day :nerd_face:

Transferring from Slack convo.

The GoT data in repurrrsive comes from an API but for teaching purposes, after I wrangle it into the list that ships with the package, I transform it back into JSON and XML files that also ship with the package.

The current script below data-raw/ uses an experimental branch of xml2 I created before xml2 had a nice function for this. I implemented as_xml() and the moral equivalent in xml2 today is as_xml_document(). But I can't just drop it in there.

https://github.com/jennybc/repurrrsive/blob/7ecc79f9a6b1925996ec20d78f0291d91451db31/data-raw/got_pov-chars-wrangle.R#L5-L7

https://github.com/jennybc/repurrrsive/blob/7ecc79f9a6b1925996ec20d78f0291d91451db31/data-raw/got_pov-chars-wrangle.R#L116-L120

> got_chars %>%
+   #xml2:::as_xml() %>%
+   as_xml_document() %>% 
+   as.character() %>% ## workaround to get explicit UTF-8 encoding
+   read_xml() %>%
+   write_xml(here("inst", "extdata", "got_chars.xml"))
Error: Root nodes must be of length 1

I haven't looked at this lately but I think there's either a buglet in as_xml_document() or a UI/documentation gap. It would be nice if I could reproduce the XML already in repurrrsive with current xml2 functions. This is a little detective adventure for someone.

Lingua principale
R
Stelle
227
Fork
86
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di r-lib/xml2

Tutte le issue di r-lib/xml2

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.