A raster is an array and is always square (rectangular), regardless of where the data occurs. Unless you have a perfectly square extent of data you will have NA values, this is part of the point of storing data in an array format. Now, one thing that does occur is that you have an extent much larger than necessary resulting in spurious NA values. In this case the raster can be subset to a smaller extent using the crop function.
When masking to a polygon, A good procedure using the raster library, is to use crop in conjunction with mask. The ensures that these spurious NA values, representing an unnecessarily large extent of empty space, are removed.
Now, there are cases where the nodata is actually a background. Here is where you can use indexing to replace NA values with real values representing a background, eg.,
x[is.na(x)] <- 0 This is common when representing a binomial process where 1 is a element of interest and the background represents an element to compare against (eg., forest/nonforest). Sometimes, in processing, the the background becomes nodata. Here is where setting NA values to a real value becomes relevant. However, one must keep in mind the edge effect. If your area of interest is irregular in shape, the areas outside are still real nodata values. This is where masking comes in.