Hello,
I tried to format my date in the dataset. All I had as a result was NA.
library(tidyverse)
library(plyr)
#> -------------------------------------------------------------------------
#> You have loaded plyr after dplyr - this is likely to cause problems.
#> If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
#> library(plyr); library(dplyr)
#> -------------------------------------------------------------------------
#>
#> Attaching package: 'plyr'
#> The following objects are masked from 'package:dplyr':
#>
#> arrange, count, desc, failwith, id, mutate, rename, summarise,
#> summarize
#> The following object is masked from 'package:purrr':
#>
#> compact
library(dplyr)
library(ggplot2)
library(data.table)
#>
#> Attaching package: 'data.table'
#> The following objects are masked from 'package:dplyr':
#>
#> between, first, last
#> The following object is masked from 'package:purrr':
#>
#> transpose
library(reprex)
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:data.table':
#>
#> hour, isoweek, mday, minute, month, quarter, second, wday,
#> week, yday, year
#> The following object is masked from 'package:plyr':
#>
#> here
#> The following object is masked from 'package:base':
#>
#> date
library(arules)
#> Loading required package: Matrix
#>
#> Attaching package: 'Matrix'
#> The following object is masked from 'package:tidyr':
#>
#> expand
#>
#> Attaching package: 'arules'
#> The following object is masked from 'package:dplyr':
#>
#> recode
#> The following objects are masked from 'package:base':
#>
#> abbreviate, write
library(arulesViz)
#> Loading required package: grid
datt1 = structure(list(CUSTOMER_NUMBER = c(0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L), Accounting_Date = c("2017-03-15", "2017-03-15",
"2018-01-23", "2018-01-23", "2018-01-05", "2018-03-15", "2018-01-23",
"2017-09-13", "2017-04-03", "2017-09-18"), PRODUCT_SUB_LINE_DESCR = c("SUNDRY",
"SUNDRY", "SUNDRY", "SUNDRY", "SUNDRY", "SUNDRY", "SUNDRY", "SUNDRY",
"SUNDRY", "SUNDRY"), ITEM_CATEGORY_DESCR = c("BURS CARBIDE SURGICAL",
"X-RAY HOLDING DEVICES - REUSABLE", "DENTAL FLOSS", "X-RAY FILM INTRAORAL",
"TOOTHPASTE PRESCRIPTION AND SPECIALTY", "ENDO AND IRRIGATION SYRINGE NEEDLES",
"STICKY WAX", "CROWN AND BRIDGE REMOVERS", "CURING LIGHT LED",
"ORAL CUP LINERS")), class = c("data.table", "data.frame"), row.names = c(NA,
-10L))
View(datt1)
str(datt1)
#> Classes 'data.table' and 'data.frame': 10 obs. of 4 variables:
#> $ CUSTOMER_NUMBER : int 0 0 0 0 0 0 0 0 0 0
#> $ Accounting_Date : chr "2017-03-15" "2017-03-15" "2018-01-23" "2018-01-23" ...
#> $ PRODUCT_SUB_LINE_DESCR: chr "SUNDRY" "SUNDRY" "SUNDRY" "SUNDRY" ...
#> $ ITEM_CATEGORY_DESCR : chr "BURS CARBIDE SURGICAL" "X-RAY HOLDING DEVICES - REUSABLE" "DENTAL FLOSS" "X-RAY FILM INTRAORAL" ...
New_Date <- as.Date(format(as.Date(datt1$Accounting_Date, "%y-%m-%d"), "%m/%d/%y"))
New_Date
#> [1] NA NA NA NA NA NA NA NA NA NA
Created on 2018-07-28 by the reprex
package (v0.2.0).