readHMDweb: readHMDweb a basic HMD data grabber.

View source: R/readHMD.R

readHMDwebR Documentation

readHMDweb a basic HMD data grabber.


This is a basic HMD data grabber, based on Carl Boe's original HMD2R(). It will only grab a single HMD statistical product from a single country. Some typical R pitfalls are removed: The Age column is coerced to integer, while an AgeInterval column is created. Also Population counts are placed into two columns, for Jan. 1st and Dec. 31 of the same year, so as to remove headaches from population universe adjustments, such as territorial changes. Fewer options means less to break. To do more sophisticated data extraction, iterate over country codes or statistical items. Reformatting can be done outside this function using, e.g., long2mat(). Argument fixup is outsourced to HMDparse().


readHMDweb(CNTRY, item, username, password, fixup = TRUE)



character. HMD population letter code. If not spelled right, or not specified, the function provides a selection list. Only 1.


character. The statistical product you want, e.g., "fltper_1x1". Only 1.


character. Your HMD user id, usually the email address you registered with the HMD under. If left blank, you'll be prompted. Do that if you don't mind the typing and prefer not to save your username in your code.


character. Your HMD password. If left blank, you'll be prompted. Do that if you don't mind the typing and prefer not to save your password in your code.


logical. Should columns be made more user-friendly, e.g., forcing Age to be integer?


This function points to the new HMD website (from June 2022) rather than the mirror of the old site that it temporarily pointed to; If your credentials fail then a likely reason is that you need to re-register at the new HMD website As soon as you register, your new credentials should work.


data.frame of the HMD product, read as as readHMD() would read it.

HMDHFDplus documentation built on Feb. 16, 2023, 8:34 p.m.