StatisticsGreenland / pxmake

pxmake: Read and write px files in R.
https://statisticsgreenland.github.io/pxmake/
Other
6 stars 3 forks source link

UNIT - order prevents pxwin to open this example from Finland #308

Open larpSTATGL opened 2 weeks ago

larpSTATGL commented 2 weeks ago

library(httr) library(jsonlite) library(pxmake)

px("http://pxweb2.stat.fi/database/StatFin/aku/statfin_aku_pxt_14bu.px") %>% px_save("statfin_aku_pxt_14bu_pxmake_johan.px")

this px-file does not open in pxwin

If UNITS="Lukumäärä, %"; UNITS[sv]="Antal, %"; UNITS[en]="Number, %";

is before STUB keyword and these below are after LAST-UPDATED pxwin is happy

UNITS("Aikuiskoulutukseen osallistuneet, lkm")="Lukumäärä"; UNITS[sv]("Deltagare i vuxenutbildning, antal")="Antal"; UNITS[en]("Participants in adult education and training, number")="Number"; UNITS("Aikuiskoulutukseen osallistuneet, %")="%"; UNITS[sv]("Deltagare i vuxenutbildning, %")="%"; UNITS[en]("Participants in adult education and training, %")="%"; UNITS("Työhön tai ammattiin liittyvään aikuiskoulutukseen osallistuneet, lkm")="Lukumäärä"; UNITS[sv]("Deltagare i arbets- eller yrkesinriktad vuxenutbildning, antal")="Antal"; UNITS[en]("Participants in adult education and training related to work or occupation, number")="Number"; UNITS("Työhön tai ammattiin liittyvään aikuiskoulutukseen osallistuneet, %")="%"; UNITS[sv]("Deltagare i arbets- eller yrkesinriktad vuxenutbildning, %")="%"; UNITS[en]("Participants in adult education and training related to work or occupation, %")="%"; UNITS("Työnantajan tukemaan koulutukseen (henkilöstökoulutukseen) osallistuneet, lkm")="Lukumäärä"; UNITS[sv]("Deltagare i utbildning som stöds av arbetsgivaren (personalutbildning), antal")="Antal"; UNITS[en]("Participants in education and training subsidised by the employer (personnel training), number")="Number"; UNITS("Työnantajan tukemaan koulutukseen (henkilöstökoulutukseen) osallistuneet, %")="%"; UNITS[sv]("Deltagare i utbildning som stöds av arbetsgivaren (personalutbildning), %")="%"; UNITS[en]("Participants in education and training subsidised by the employer (personnel training), %")="%"; UNITS("Muuhun kuin työhön tai ammattiin liittyvään aikuiskoulutukseen osallistuneet, lkm")="Lukumäärä"; UNITS[sv]("Deltagare i annan än arbets- eller yrkesinriktad vuxenutbildning, antal")="Antal"; UNITS[en]("Participants in adult education and training not related to work or occupation, number")="Number"; UNITS("Muuhun kuin työhön tai ammattiin liittyvään aikuiskoulutukseen osallistuneet, %")="%"; UNITS[sv]("Deltagare i annan än arbets- eller yrkesinriktad vuxenutbildning, %")="%"; UNITS[en]("Participants in adult education and training not related to work or occupation, %")="%";

larpSTATGL commented 2 weeks ago

it is not the order, that prevents pxwin to open the file, can better be seen if saved to excel:

px("http://pxweb2.stat.fi/database/StatFin/aku/statfin_aku_pxt_14bu.px") %>% px_save("statfin_aku_pxt_14bu_pxmake_johan.xlsx")

johan-ejstrud commented 2 weeks ago

So we don't know what causes the error? In that case we need to figure that out first. I suggest removing non-mandatory keywords one by one, until the file can be opened by PXWin again.

Also, I just took a quick look at the file and noticed this peculiar line right before the DATA line.

MADE-WITH="PxPro";

Maybe this causes the error?