I am new to shinyR and I would like to convert the values in a column of an existing data frame into row names and the values in a column into col names . Something like this data:
Date Type Count
23 May 2005 A 2
24 May 2005 B 1
25 May 2005 D 3
26 May 2005 D 3
26 May 2005 A 3
Into this :
23 May 2005 24 May 2005 25 May 2005 26 May 2005
A 2 0 0 3
B 0 1 1 0
Other 0 0 3 3
I tried :
vcol <- length(data$date)
table119 <- matrix(data$count, ncol=vcol,byrow=TRUE)
rownames(table119) <- data$type
colnames(table119) <- data$date
table_stathas <- - DT::renderDataTable({table119()})
but it is not working
It is different from Convert the values in a column into row names in an existing data frame in R , I want to change the colnames and the rownames with the value of the columns Date and Type that are not uniques