# Generation through estimateDataTemporalMap function:
dataset <- read.csv2(system.file("extdata",
"nhdsSubset.csv",
package="EHRtemporalVariability"),
sep = ",",
header = TRUE,
na.strings = "",
colClasses = c( "character", "numeric", "factor",
"numeric" , rep( "factor", 22 ) ) )
datasetFormatted <- EHRtemporalVariability::formatDate(
input = dataset,
dateColumn = "date",
dateFormat = "%y/%m")
probMaps <- estimateDataTemporalMap(data = datasetFormatted,
dateColumnName = "date",
period = "month")
class( probMaps[[1]] )
# Manual generation:
countsMatrix <- matrix(sample.int(25, size = 12*10, replace = TRUE), nrow = 12, ncol = 10)
probabilityMatrix <- sweep(countsMatrix,1,rowSums(countsMatrix),"/")
dates <- seq(Sys.Date(),(Sys.Date()+30*11),30)
x <- new('DataTemporalMap', probabilityMap = probabilityMatrix,
countsMap = countsMatrix, dates = dates, support = data.frame(1:10),
variableName = "example", variableType = "numeric", period = "month")
plotDataTemporalMap(x)
Run the code above in your browser using DataLab