#' Seperate data and time functionality
#'
#' This function can in principle seperate any amalgamated character vector column member of the data frame where elements are sepearted by " " space.
#'
#' @param df Input data frame.
#' @param column_specifying_data Either a boolean with single TRUE case or a single numeric indicating what column is has date and time.
#' @return An updated data frame where data-time column are seperate.
#' @export
seperate_date_and_time = function(df, column_specifying_data){
if(class(column_specifying_data)=="numeric"){
if(!length(column_specifying_data)==1){stop("If column_specifying_data is numeric it must me of lenght 1.")}
}
date_time = as.character(df[,column_specifying_data])
date_time = unlist(strsplit(x = date_time, split = " ",fixed = T))
date = date_time[seq(1,length(date_time),by = 2)]
time = date_time[seq(2,length(date_time),by = 2)]
df[,column_specifying_data] = NULL
df = cbind(df,date,time)
return(df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.