r <- raster(ncol=3, nrow=3)
values(r) <- 1:ncell(r)
as.character(r)
s <- stack(r, r)
as.character(s)
as.character(extent(s))
x <- as.character(s)
eval(parse(text=x))
y <- as.character(extent(s))
eval(parse(text=y))
Run the code above in your browser using DataLab