adhan package: retreiving and aligning the prayer times in R

[This article was first published on gacatag, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.


The adhan package is available here !

 The prayer times cannot always be estimated accurately in some places such as countries located in higher latitudes (e.g. the Nordic countries) . as for instance during midsummer time the Fajr may be impossible to estimate or in other words it may simply not exist ! Some Muslim residents of those countries follow Prayer times of other places such as Mecca and Medina. However, day light saving times can make it complicated ! Furthermore, some align the Dhuhr prayer time of Mecca to the local Dhuhr time and measure all the remaining times based on their differences from Dhuhr in Mecca. This would also resolve complications caused by the daylight saving time. The adhan package facilitates mapping of the prayer times of two locations based on alignment over a specific time (e.g. Dhuhr).  It can also show the prayer times of a city using several methods. The package is dependent on the  Aladhan API.

 The library is available on GACATAG GitHub. It can be installed using install_github() function supported by devtools package.


The following script shows the local prayer times of Helsinki, Finland for today (1st of April 2024), measured by the “Institute of Geophysics, University of Tehran” method. A specific day and month na dyear can also be mentioned. For more info check the parameter settings by typing ?adhan::adhan.

adhan::adhan(city=”Helsinki”, country=”Finland”, method=7)
#          date           Fajr        Sunrise          Dhuhr            Asr         Sunset        Maghrib
#  “01-04-2024” “04:07 (EEST)” “06:44 (EEST)” “13:24 (EEST)” “16:50 (EEST)” “20:05 (EEST)” “20:36 (EEST)”
#          Isha          Imsak       Midnight     Firstthird      Lastthird
#”22:02 (EEST)” “03:57 (EEST)” “01:24 (EEST)” “23:38 (EEST)” “03:11 (EEST)”

Currently there are 17 methods which are supported by the Aladhan API. Defining a custom method is also possible. The following shows the Helsinki prayer times for the entire month of April 2024.

HelsinkiAdhanApr2024<- adhan::adhanMonth(

The following maps the parayer times of Mecca to helsinki by aligning the Dhuhr of the two cities.

HelsinkiMeccaAdhanApr2024<- adhan::adhanMapMonth(
    mapCountry=”Saudi Arabia”,

The tables can be organized into a nicer format using functions from the kableExtra library.

x<- kbl(HelsinkiMeccaAdhanApr2024,
    table.attr = “style=’width:100%;'” ) %>%
    kable_classic(full_width = TRUE, position = “center” )


as_image(x, file=”April.png”)

To leave a comment for the author, please follow the link and comment on their blog: gacatag. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)