my first r script (nth time) – all about matrices examples

to open script window:
cmd + n

run r command from script window:
cmd + enter

All about Matrices:
#saving 12 numbers from 1 to 12 in a vector
v <- 1:12
v
#with out any options, vector got converted into 1 column table?(can we say table?)
matrix(v)

#first parameter is data, second parameter is no of rows
#if second parameter is ignored, default is length of data vector
matrix(v, 2)

#looks like doesn’t matter even the data is greater than required
matrix(v, 2, 4)

ప్రకటనలు

About a2zdreams

No Rules .. No Restrictions ..
This entry was posted in a2z. Bookmark the permalink.