Create a small matrix of numbers to do some examples

look<- matrix( 1:12, ncol=4, nrow=3)
look
##      [,1] [,2] [,3] [,4]
## [1,]    1    4    7   10
## [2,]    2    5    8   11
## [3,]    3    6    9   12

Create an NA

look[2,3] <- NA
look
##      [,1] [,2] [,3] [,4]
## [1,]    1    4    7   10
## [2,]    2    5   NA   11
## [3,]    3    6    9   12
look2<- is.na( look)
look2
##       [,1]  [,2]  [,3]  [,4]
## [1,] FALSE FALSE FALSE FALSE
## [2,] FALSE FALSE  TRUE FALSE
## [3,] FALSE FALSE FALSE FALSE
 look==4 
##       [,1]  [,2]  [,3]  [,4]
## [1,] FALSE  TRUE FALSE FALSE
## [2,] FALSE FALSE    NA FALSE
## [3,] FALSE FALSE FALSE FALSE

Applying over rows and columns

apply( look, 1, "max")
## [1] 10 NA 12
apply( look, 2, "max")
## [1]  3  6 NA 12

Here is an image plot of this matrix

image(1:3, 1:4, look, col=rainbow(256))

Here is an image plot of this matrix using the fields function that adds a legend

library(fields)
## Loading required package: spam
## Loading required package: grid
## Spam version 1.3-0 (2015-10-24) is loaded.
## Type 'help( Spam)' or 'demo( spam)' for a short introduction 
## and overview of this package.
## Help for individual functions is also obtained by adding the
## suffix '.spam' to the function name, e.g. 'help( chol.spam)'.
## 
## Attaching package: 'spam'
## 
## The following objects are masked from 'package:base':
## 
##     backsolve, forwardsolve
## 
## Loading required package: maps
## 
##  # ATTENTION: maps v3.0 has an updated 'world' map.        #
##  # Many country borders and names have changed since 1990. #
##  # Type '?world' or 'news(package="maps")'. See README_v3. #
image.plot(1:3, 1:4, look, col=rainbow(256))