Introduction to R: Dealing With Dates

preview_player
Показать описание
Date and datetime data is often loaded into R as strings by default, but to work with dates effectively they need to be converted to date formats that allow for exaction of useful information like the day of the week. In this lesson we cover the basics of working with dates in R.

This is lesson 16 of a 30-part introduction to the R programming language for data analysis and predictive modeling. Link to the code notebook below:

This guide does not assume any prior exposure to R, programming or data science. It is intended for beginners with an interest in data science and those who might know other programming languages and would like to learn R.

I will create the videos for this guide such that you should be able to learn a lot just watching on YouTube, but to get the most out of the guide, it is recommended that you create a Kaggle account so that you can fork and edit each lesson so that you can follow along and run code yourself.

Follow DataDaft on social media for news and updates:

Introduction to R Playlist:
Рекомендации по теме
Комментарии
Автор

I have finally understand how to convert to time date format, thanks a lot for your clear and detailed explanation

fatmashehab
Автор

That was a great explanation of POSIXct and POSXlt. I finally really understand it.

pimpmatick
Автор

Thank you so much! I'm new to R and was getting really frustrated in finding an explanation that is easy to understand until I found this video!

Reborn
Автор

Your video sounds good, but my date variable format is a “chr” with values like “35357” after importing from Access. How can these variables be converted to a date format? Thanks!

stevep
Автор

great explaination!
i have a dataset containing time period, I want to categorise it into early morning, morning, mid-day, afternoon, evening...
kindly suggest me a line of code for it..

poojamahesh
Автор

Hello, thanks so much for this lesson. Would you be able to explain how to cane the times zones? For example from UTC to EST

heyybigdaddy
Автор

Thank you! I have one question, if I have two columns, date1 and date2, and I want to find the minimum date between the 2 columns, is there a specific function?

raymilan
Автор

Any suggestion to what to do if the collumn name are the dates and the data is across...

ciroweinstein
Автор

Thanks very much for making such wonderful videos. I learned many packages from watching your videos. I have a small query, can you please explain how to extract a month from the year-week format date? Ex: "2018-3" (%Y-%W) to Month. I tried searching the net unable to find the answer.

vinodkukanur
Автор

Thank you for that video!

However, I'm still stuck... I'd like to convert a column extracted from Excel that is in numerical time (0.54036, 0.55625) to a proper date-time format (13:02, 13:21...). I use data from public transit data sources, in such way that 1.00833 is 00:12.

Would you have the code to do that?

cookie.lover
Автор

Thank you, very helpful Posixlt in 5:29

vinicioalvarado
Автор

Hi there!
I need to take out the maximum values from a diary data serie. I have to extract the maximum values from each year. How could i do It?

eldelbharadri
Автор

I have a variable "ACCIDENT_TIME", it is in chr class..how should I convert it to the proper class

poojamahesh
Автор

Hi I want to convert date column in data file from DDMMYYYY to YYYYMMDD, how I can do?

jaldipkarangiya
Автор

What do we do if the data is not formatted in one of those ways? For example, my data is in the format: 1/1/2021. Thank you!

claire
Автор

What if we want to convert date time to just date

pink
Автор

shall we deal with DDMMYYYY date format?

jaldipkarangiya
Автор

Hi Great video can I ask you a question please

Jonpaulim
Автор

I would like to convert these dates with format YYYYMMDD to a Date class.

dates <- data.frame(Date = c("22-02-2012", "20-11-2006", "14-05-2015", "18-12-2016"))

I tried:

dates <- as.Date(dates, "%Y%m%d")

And I get the following error:

Error in as.Date.default(dates, "%Y%m%d") : do not know how to convert..
Please give solution please..

poojamahesh
Автор

Thank u for this. What to do if u had a column with mixed date format
Ddmmyyy
Mmddyyyy
Yyyymmdd

ahmedJaber