May 2007

Repeat elements of a vector

May 17, 2007 | 0 Comments

Two methods. The first produces a vector, the second a one column matrix.x=1:10# Method 1rep(x,each=3)# Method 2matrix(t(matrix(x,length(x),3))) [Read more...]

Convert image to matrix in R

May 17, 2007 | 0 Comments

This is how to use the Pixmap library to read in an image as a matrix.__ library(pixmap)# the next command may only work on Linux__ system("convert foo.tiff foo.ppm")__ img To get info on your new object: __ str(img)Although included in the previous output, the size ... [Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)