I am facing one problem, I have a dataset which is for in and out time, column 1 to five is related to emid and dept. etc. from colum 6 to till end it has login data in the following format "02-01-15 16:56 ", I want to remove date and keep the time only. I have to exclude columns 1 to 5 and to format columns from 6 to last. so I am using lapply but I am facing following error.
emp_intime <- as.data.frame(lapply( emp_intime[, -1], as.POSIXlt))
Error in as.POSIXlt.numeric(X[[i]], ...) : 'origin' must be supplied
emp_intime <- as.data.frame(lapply( emp_intime[, -1], as.POSIXlt))
Error in as.POSIXlt.numeric(X[[i]], ...) : 'origin' must be supplied
I am getting an error, expected result is to remove the date from the every columns and leave only time.
Input Data:
structure(list(X = 1L, EmployeeID = 1L, Gender = "Female", Department = "Sales", YearsAtCompany = 1L, X01.01.15 = NA, X02.01.15 = "02-01-15 9:43", X05.01.15 = "05-01-15 10:08", X06.01.15 = "06-01-15 9:54", X07.01.15 = "07-01-15 9:34", X08.01.15 = "08-01-15 9:51", X09.01.15 = "09-01-15 10:09", X12.01.15 = "12-01-15 9:42", X13.01.15 = "13-01-15 10:13", X14.01.15 = NA, X15.01.15 = "15-01-15 10:01", X16.01.15 = "16-01-15 10:19", X19.01.15 = NA_character_, "), row.names = 1L, class = "data.frame")