epidata-xml-to-r's People
Forkers
charlesknightsbridgeepidata-xml-to-r's Issues
Error in xmlChildren(these.data)[[i]] : subscript out of bounds
Hello,
Thank you for your code.
I am a statistician and a R beginner. I need to import multiple files .epx from Epidata and your code would be very usefull.
Unfortunatly, error "Error in xmlChildren(these.data)[[i]] : subscript out of bounds" is generated when I run your code. Any idea to help me?
Thank you again for your code and your help,
Laura
convert EpiData logical
Hi David,
Logical type is not well documented
Field type = 0
Can have values "Y", "N" or be blank (system missing); value labels not allowed as far as I know.
conversion code:
} else if (fld.type == 0){
## Logical - empty to NA, Y to TRUE, else to FALSE
x[x==""] <- NA
x <- x=="Y"
Jamie
Deal with potential inconsistency between labels and data
It is possible to enter data, and later add labels that do not include all of the values entered previously. Importing such a file causes the application of labels to fail because the factor levels don't match.
Detect it, report it, and attempt to apply the labels where possible.
From Jamie: Perhaps give a warning and assign value label such as "Unknown label 1" so that every value would have a corresponding unique label.
But might be better to leave the data originally entered, as this would allow the user to know what the values were and recode manually in R.
no value labels gives Error in y[[i]] : subscript out of bounds
Some .epx files will have no value labels. Catch this in get.epidata.value.labels with:
y <- xmlElementsByTagName(x, "ValueLabelSet", rec = TRUE)
if (xmlSize(y)==0) return(NULL)
Filter rows on import
I think it should be possible to use handlers in xmlTreeParse() to filter rows when parsing the epidata XML file. This could be useful if the file is very large and there is a meaningful way of using a subset (perhaps random selection, or rows that match certain criteria).
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.