I'm working on a project that involves porting MATLAB code into R, and have run into a bit of trouble with one chunk of code. 

What the piece of code does in MATLAB is resizes a mask (just 1s and 0s) to be the same sizes as a much larger set of data that it will be masking. The data that the mask is applied to changes in size, so I can't just set static values for the scaling. 

The MATLAB code has a function [resizem](http://www.mathworks.com/help/map/ref/resizem.html) that resizes the mask, preserving the only 1s and 0s characteristic.

I've searched (to no avail) for solutions to my problem, but I don't think that my issue plagues many R users (it's a non-traditional use of R). So I was wondering if anyone knew a way to resize a matrix in the same way that resizem does.

For Example:

If I had the array

```
[1,0,1,1,1,
0,0,0,1,1,
1,1,0,0,1]

```

And I wanted to scale it from 3x5 to 7x10 with the 7x10 matrix containing only 1s and 0s like this.

```
 1     1     0     0     1     1     1     1     1     1
 1     1     0     0     1     1     1     1     1     1
 0     0     0     0     0     0     1     1     1     1
 0     0     0     0     0     0     1     1     1     1
 0     0     0     0     0     0     1     1     1     1
 1     1     1     1     0     0     0     0     1     1
 1     1     1     1     0     0     0     0     1     1

```

How could I approach this with an R function.