timriffe / TR1

Read Human Mortality Database and Human Fertility Database Data from the Web
10 stars 4 forks source link

can't read HFD data #24

Closed yutingli-moi closed 2 months ago

yutingli-moi commented 2 months ago

Hi, I'm using the readHFD commond, but can't work. The package version is HMDHFDplus version: 2.0.5. That's error information I got:

data <- readHFD("https://www.humanfertility.org/File/GetDocument/Files/AUT/20210825/AUTtfrRR.txt")
> Error in read.table(file = filepath, header = TRUE, skip = 2, na.strings = ".", : 
> There are more columns than column names

It seems because of the blank spaces exist between columns. So I try to pass other arguments from read.table, such as:

data <- readHFD("https://www.humanfertility.org/File/GetDocument/Files/AUT/20210825/AUTtfrRR.txt", sep="", strip.white=T, blank.lines.skip=T, skipNul=T)

I tried these arguments separately and together, but same error still happen. Could you help with this issue?

timriffe commented 2 months ago

Hello, To read data from the web, you should use readHFDweb(). readHFD() is for local HFD files only. Please create a new issue report if you run into trouble there. Regards, Tim

yutingli-moi commented 1 month ago

Hi Tim, thank you so much for your reply. I am using readHFDweb() now, and it works smoothly. Best, Yuting