Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Putting Labels to a table in R

$
0
0

@Surya1987 wrote:

I have generated the below table(frequency table) and I am getting the row names and column names. However I also need the label on the top and left side. How can we do that?

sl <- cut(Oceanair$t_ambient,breaks=c(0,44,62,78,95.5,107.5,max(Oceanair$t_ambient,na.rm=TRUE)))
table(sl)
pl <- cut(Oceanair$derate,breaks=c(0,5,15,max(Oceanair$derate,na.rm=TRUE)))
table(pl)
table(sl,pl)
a <-as.matrix(table(pl,sl))
colnames(a) <- c("0 > 44","44 > 62","62 > 78","78 > 95.5","95.5 > 107.5",">107.5")
rownames(a) <- c("0 > 5","5 > 15",">15")
a<-as.table(a)
a <- round(prop.table(a)*100,2)
a1 <- a
a1[] <- sprintf("%.1f%%",round(prop.table(a,1)*100, 2))
png(filename = "table.png")
grid.table(a1)
dev.off()

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles