zodiac: Get the astrological sign / zodiac symbol for date(s)

View source: R/time_fun.R

zodiacR Documentation

Get the astrological sign / zodiac symbol for date(s)

Description

zodiac provides the tropical zodiac sign or symbol (aka. astrological sign) for given date(s) x.

Usage

zodiac(
  x,
  out = "en",
  zodiac_swap_mmdd = c(120, 219, 321, 421, 521, 621, 723, 823, 923, 1023, 1123, 1222)
)

Arguments

x

Date (as a scalar or vector, required). If x is not a date (of class "Date"), the function tries to coerce x into a "Date".

out

Output format (as character). Available output formats are: English/Latin (out = "en", by default), German/Deutsch (out = "de"), HTML (out = "html"), or Unicode (out = "Unicode") symbols.

zodiac_swap_mmdd

Monthly dates on which the 12 zodiac signs switch (in mmdd format, ordered chronologically within a calendar year).

Default start dates are set to zodiac_swap_mmdd = c(0120, 0219, 0321, 0421, 0521, 0621, 0723, 0823, 0923, 1023, 1123, 1222) for Zodiac sign c("Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces", respectively.

Alternative start dates for Zodiac signs in some sources include 0420 for Taurus, 0824 for Leo, 1122 for Sagittarius (in mmdd format).

Details

zodiac is flexible by providing different output formats (in Latin/English, German, or Unicode/HTML, see out) and allowing to adjust the calendar dates on which a new zodiac is assigned (via zodiac_swap_mmdd).

Value

Zodiac label or symbol (as a factor).

Source

See https://en.wikipedia.org/wiki/Zodiac or https://de.wikipedia.org/wiki/Tierkreiszeichen for labels, dates, and alternative date ranges.

See Also

Zodiac() function of the DescTools package.

Other date and time functions: change_time(), change_tz(), cur_date(), cur_time(), days_in_month(), diff_dates(), diff_times(), diff_tz(), is_leap_year(), what_date(), what_month(), what_time(), what_wday(), what_week(), what_year()

Examples

zodiac(Sys.Date())

# Works with vectors:
dt <- sample_date(size = 10)
zodiac(dt)

# Factor levels:
levels(zodiac(dt))

# Alternative outputs:
zodiac(dt, out = "de")       # German/deutsch
zodiac(dt, out = "Unicode")  # Unicode
zodiac(dt, out = "HTML")     # HTML

# Alternative date breaks:
zodiac("2000-08-23")  # 0823 is "Virgo" by default
zodiac("2000-08-23",  # change to 0824 (i.e., August 24): 
       zodiac_swap_mmdd = c(0120, 0219, 0321, 0421, 0521, 0621, 
                            0723, 0824, 0923, 1023, 1123, 1222))



ds4psy documentation built on Nov. 4, 2026, 9:07 a.m.