dami82 / easyPubMed

easyPubMed package for R - dev version
21 stars 8 forks source link

Problem with October pub dates #2

Closed buyske closed 4 years ago

buyske commented 4 years ago

The article_to_df function seems to convert at least some October publication dates to a value of month equal to 0. For example,

get_pubmed_ids(27463701) %>% fetch_pubmed_data() %>% article_to_df(getAuthors = FALSE)

shows the correct year, but the month is given as 0 instead of 10.

dami82 commented 4 years ago

Hi Steve,

thanks for reporting this issue. As you pointed out, there was a bug in article_to_df(). This has been fixed. Also, let me confirm that the date field being extracted from the record is the [PubDate] and NOT the [DateCompleted] field (as I erroneously mentioned before. Again, thanks for using easyPubMed and reporting this issue.

get_pubmed_ids(27463701) %>% fetch_pubmed_data() %>% article_to_df(getAuthors = FALSE) %>% select(pmid, doi, year, month, day, jabbrv)

pmid doi year month day jabbrv

1 27463701 10.1002/ana.24744 2016 10 1 Ann. Neurol.

Note that the day is missing but it is imputed to 1.

dami82 commented 4 years ago

article_to_df() was updated, and the bug was fixed. The following code now returns the expected result, i.e. "10".

get_pubmed_ids(27463701) %>% fetch_pubmed_data() %>% article_to_df(getAuthors = FALSE) %>% pull(month)