Q:

How to "customize" my elements in a matrix R

I wanna build an nxm matrix, n< m, and i want each element Mij = i^j
Any ideas? I tried multiplying various vectors etc but i never get the correct result.

A:

n <- 3
m <- 4
outer(seq_len(n), seq_len(m), "^")
#     [,1] [,2] [,3] [,4]
#[1,]    1    1    1    1
#[2,]    2    4    8   16
#[3,]    3    9   27   81

