R - Split date into dd,mm,yy

0 votes
How to Split date and convert into separate columns in the dataframe using dplyr pacakge?
Aug 1 in Data Analytics by misha
57 views

1 answer to this question.

0 votes

I use superstore data and show how to extract date parts separately.

> head(superstore$Order.Date,5)
[1] "11-11-2014" "05-02-2014" "17-10-2014" "28-01-2014" "05-11-2014"

> day = strsplit(superstore$Order.Date,split = "-")
> head(day,5)
[[1]]
[1] "11"   "11"   "2014"

[[2]]
[1] "05"   "02"   "2014"

[[3]]
[1] "17"   "10"   "2014"

[[4]]
[1] "28"   "01"   "2014"

[[5]]
[1] "05"   "11"   "2014"
answered Oct 31 by Cherukuri
• 32,260 points

Related Questions In Data Analytics

0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,560 points
84 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
173 views
0 votes
1 answer

How can I import multiple .csv files into R ?

## import_multiple_csv_files_to_R # Purpose: Import multiple csv files ...READ MORE

answered Apr 19, 2018 in Data Analytics by zombie
• 3,710 points
933 views
0 votes
1 answer

How to import data from a Json file into R?

Easy and simple: library("rjson") json_file <- "file_name" json_data <- fromJSON(file=json_file)) or ...READ MORE

answered Apr 26, 2018 in Data Analytics by DeepCoder786
• 1,720 points
261 views
0 votes
2 answers

How to use group by for multiple columns in dplyr, using string vector input in R?

data = data.frame(   zzz11def = sample(LETTERS[1:3], 100, replace=TRUE),   zbc123qws1 ...READ MORE

answered Aug 5 in Data Analytics by anonymous
3,796 views
0 votes
1 answer

How to group all columns exculding a single column?

You can either use group_by or group_by_at Using ...READ MORE

answered Apr 12, 2018 in Data Analytics by darklord
• 6,190 points
100 views
0 votes
1 answer

How to limit output of a dataframe in R?

For randomly sampling a row/cell where a ...READ MORE

answered Apr 18, 2018 in Data Analytics by kappa3010
• 2,020 points
65 views
0 votes
1 answer

Using dplyr package to summarise multiple columns - R

'dplyr' package provides 'summarise_all()' function to apply ...READ MORE

answered Jun 6, 2018 in Data Analytics by Bharani
• 4,560 points
475 views
0 votes
1 answer
0 votes
2 answers

Splitting the data into training and testing sets - R

Hi, Try like this. train = sample(x = ...READ MORE

answered Aug 20 in Data Analytics by anonymous
• 32,260 points
1,349 views