Data wrangling is the process of importing, cleaning, and transforming raw data into actionable information for analysis. It is a time-consuming process that is estimated to take about 60-80% of analysts’ time. In this series, we will go through this process. It will be a brief series with the goal of crafting the reader’s skills in data wrangling¥. This is the fourth part of the series, and it aims to cover the cleaning of data used. In previous parts, we learned how to import, reshape, and transform data. The rest of the series will be dedicated to the data cleansing process. In this post we will go through the date values, which is a very popular and tricky data type.
Before proceeding, it might be helpful to look over the help pages for the
Moreover, please run the following commands:
now <- Sys.time()
Answers to the exercises are available here. If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page.
For other parts of this exercise set follow the tag Data Wrangling
Convert the following string to Date and assign it to the object ‘date’.
date_sep <- c("27-09-2017", "28-09-2017", "29-09-2017")
Extract the years from the dates you have created before.
Find the weekdays from the date object.
Create a sequence of dates, from the first day of 2017 till today by week.
Find how many days have passed from the first day of 2017 till today.
Calculate the date 6 months from now.
Change the current time to time zone “IST”.
Change the time zone without changing the clock time to “IST.”
Calculate the time difference between your time zone and “IST” time zone.
Print out how much time it took you to finish this set of exercises. Bear in mind that we have created the object ‘now’ at the beginning of the exercise, which contains the time that you started solving those exercises.