Last active
May 29, 2019 05:08
-
-
Save apoorv74/93d8fa8eb90c04717d26995fcd6d2165 to your computer and use it in GitHub Desktop.
To read data from HMIS files - https://nrhm-mis.nic.in/hmisreports/frmstandard_reports.aspx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
library(readr) | |
# This file needs to be read as text. | |
x <- readr::read_file("~/Downloads/Chandigarh.xls") | |
# Every file will have a table, the way it is structured in this sample. We just want to extract this table and convert it to a data frame | |
# Check and clean the file as per the structure of the original one. Headers and Rows need to be adjusted. | |
y <- x %>% read_html() %>% html_table(fill = TRUE) | |
z <- y[[1]] | |
View(z) | |
# To get all headers | |
y <- x %>% read_html() %>% html_nodes(css = '.header') %>% html_text() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment