Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Docs encoding (convert to JSON?) #38

Closed
reinholdsson opened this issue Nov 1, 2013 · 4 comments
Closed

Docs encoding (convert to JSON?) #38

reinholdsson opened this issue Nov 1, 2013 · 4 comments

Comments

@reinholdsson
Copy link
Contributor

Fix docs encoding in put-variable-doc.r. Use file(..., encoding = "UTF-8"). Perhaps one should also add this argument to the cdb class.

In addition, a minor fix, add tmp as an argument at the following line: https://github.com/SthlmR/Coldbir/blob/master/R/put-variable-doc.r#L18

@reinholdsson
Copy link
Contributor Author

OK:

a["SEKTORTILLHORIGH", 2010] <- doc(title = "Sektortillhorighet for anstallda", source="MIDAS")

Not OK (error):

a["SEKTORTILLHORIGH", 2010] <- doc(title = "Sektortillhörighet för anställda", source="MIDAS")

@reinholdsson
Copy link
Contributor Author

This is because of yaml::as.yaml as used in https://github.com/SwedishPensionsAgency/Coldbir/blob/dev/R/doc-class.r#L65.

See related issue vubiostat/r-yaml#4.

> as.yaml(list('é'))
Error in as.yaml(list("é")) : 
  Emitter error: expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS
> as.yaml(list('é'), unicode = F)
Error in as.yaml(list("é"), unicode = F) : 
  Emitter error: expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS
> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Swedish_Sweden.1252  LC_CTYPE=Swedish_Sweden.1252   
[3] LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C                   
[5] LC_TIME=Swedish_Sweden.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
 [1] yaml_2.1.7        pmtools_0.1       stringr_0.6.2    
 [4] RCurl_1.95-4.1    bitops_1.0-6      RJSONIO_1.0-3    
 [7] httr_0.2          whisker_0.3-2     RODBC_1.3-8      
[10] devtools_1.3      data.table_1.8.10

loaded via a namespace (and not attached):
[1] digest_0.6.3   evaluate_0.4.7 formatR_0.9    knitr_1.5     
[5] markdown_0.6.3 memoise_0.1    parallel_3.0.1 tools_3.0.1   

For Windows, only 2.1.7 is available on CRAN. Not sure of whether this is the reason. Needs further investigation.

@reinholdsson
Copy link
Contributor Author

We could use json instead of yaml (as previous Coldbir versions). It also depends on how the documentation is supposed to be created and maintained...

@reinholdsson
Copy link
Contributor Author

For implementation, see pull request #60.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant