How to determine the zodiac symbol in R?
Today I have used some statistics using Excel
and R
. Part of the job requires determining the zodiac symbol according to the date of birth. I did this in Excel:
Sample data:
DOB
25-Jan-1985
25-Jul-1983
28-Aug-1982
24-Feb-1984
13-Jan-1985
24-Jan-1982
15-Feb-1984
14-Oct-1983
08-Sep-1984
04-Mar-1983
04-Apr-1984
31-Mar-1985
04-Aug-1984
29-Jan-1984
20-Jul-1984
...
Here is the rule for determining the symbols of the zodiac:
Dec. 22 - Jan. 19 - Capricorn
Jan. 20 - Feb. 17 - Aquarius
Feb. 18 - Mar. 19 - Pisces
March 20 - April 19 - Aries
April 20 - May 19 - Taurus
May 20 - June 20 - Gemini
June 21 - July 21 - Cancer
July 22 - Aug. 22 - Leo
Aug 23 - Sept. 21 - Virgo
Sept. 22 - Oct. 22 - Libran
Oct. 23 - Nov. 21 - Scorpio
Nov. 22 - Dec. 21 - Sagittarius
Excel formula:
=LOOKUP(--TEXT(A2,"mdd"),{101,"Capricorn";120,"Aquarius";219,"Pisces";321,"Aries";420,"Taurus";521,"Gemini";621,"Cancer";723,"Leo";823,"Virgo";923,"Libran";1023,"Scorpio";1122,"Sagittarius";1222,"Capricorn"})
I am wondering how to do this in R
? Also data.table
great, is it possible to figure it out in data.table
?
+3
source to share