xxxxxxxxxx
# R Program to create
# a tabular representation of data
# Creating a vector
vec = c(2, 4, 3, 1, 2, 3, 2, 1, 4, 2)
# Calling table() Function
table(vec)
Output:
# vec
# 1 2 3 4
# 2 4 2 2
#by faycal elourrat ^.^
xxxxxxxxxx
# create matrix with 4 columns and 4 rows
data= matrix(c(1:16), ncol=4, byrow=TRUE)
# specify the column names and row names of matrix
colnames(data) = c('col1','col2','col3','col4')
rownames(data) <- c('row1','row2','row3','row4')
# assign to table
final=as.table(data)
# display
final