Create a list from matrix in R -


i have 2 lists v , w , create again list z matrix m . how can in r?

    v = list(a = c(1, 5), b = 2, c= 3)     w = list( a= c(2, 10), b = 4, c = 6)     m  =  as.matrix(unlist( v) * unlist(w))     > m         [,1]     a1    2     a2   50     b     8     c    18     z = list(a = c(2, 50), b = 8, c = 18) 

do this:

mapply(`*`, v, w) 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -