stackoverflow, gis.stackexchange, r-sig-geo and the examples in the manuals of sp and the raster package and other packages are full of examples how to do that. Here are some:
library(raster)
# example files
f1 <- system.file("external/test.grd", package="raster")
r <- raster(f1)
f2 <- system.file("external/rlogo.grd", package="raster")
b <- brick(f2)
# create your own
x <- raster(nrow=18, ncol=36)
values(x) <- runif(ncell(x))
y <- raster(nrow=10, ncol=10, xmn=0, xmx=10, ymn=0, ymx=10, crs='+proj=utm +zone=2')
values(y) <- 1:ncell(y)