# Retrieving date ranges with the r platform

Using r if I have a data frame that contains dates and temperatures.

I would like to pull out all temperatures for January how would I go about

phrasing this. I've tried may ways such as

louisville_weather <- filter(louisville_weather$DATE <= 2013-01-31)  • I think stackoverflow.com would be more appropriate for your question, as this is rather a coding issue rather than a Data Science question. Jan 5 '19 at 12:17 • Hey friend, r programming is for data science. Where is the best place to find fast answers: of course the data science stack exchange! Jan 6 '19 at 11:52 • Sorry @Chris Kehl if you have misunderstood me. Not that it's an incorrect or inappropriate post, but you might get more peers and hence quicker (and possibly more varied) answers on stackoverflow. Particularly since people don't have to know data science in order to answer this particular question-- but knowledge in R would be fine. However then, I would have missed the chance of answering it (and getting kudos) since someone else must surely have posted a good enough answer before me ! Thanks, anyway, dear friend. Jan 6 '19 at 14:05 ## 1 Answer If louisville_weather$DATE is formatted as POSIXct, the month can be extracted, thanks @RockScience, with

lvmonth <- format(louisville_weather\$DATE, "%m")


It's a character variable. So, filtering

louisville_weather <- louisville_weather[lvmonth == "01", ]


should extract your weather for January.

Hope you'll find it cold enough to balance the warmth of datascience.SX !