adehabitat: Number of categories of each habitat
Hello
Apologies for asking such a simple question, but I have been having
problems obtaining a simple summary of the habitat classes in a
categorical (factor) asc map in the adehabitat library. It has been
created from overlaying an mcp polygon as follows:
# Importation of asc files: factor e.g vegetation map
(vegm <- paste("Y:/Map Import/veg05_7.asc", sep = "/")) # veg05_7 is a vegetation map with 10 classes
(vegt <- paste("Y:/Map Import/veg05_2.txt", sep = "/")) # veg05 is a table with the names of the 10 classes
veg <- import.asc(vegm, lev = vegt, type = "factor")
# A Script to compute Homerange using Minimum Concex Polygon(MCP)
roans<-read.csv("Y:/PhD Data/Data Analysis/Roan Data Analysis/Rawdata/NTO_G.csv") # Load the data
xy<-roans[,c("X","Y")] # combine columns X & Y into a new column labelled xy
id<-roans$Group # Allocate label id to Group column
hrtg<-mcp(xy,id,percent=95) # Compute the homerange MCP
## Converts the home range to raster
hrrast <- hr.rast(hrtg, veg)
## for each relocation, finds the values of the variables in x
mcpveg = setmask(veg, hrrast)
hrrast2 = getkasc(hrrast, "Nyatoto Group")
mcpveg = setmask(veg, hrrast2)
The asc map, mcpveg, produced by the final setmask function contains
just the vegetation types within the MCP. This map displays correctly.
However, I'm unclear on how to obtain a numerical summary of the number
of cells of each vegetation type, or percentage of each vegetation type,
within the
MCP. Typing:
summary(mcpveg)
gives hundreds of columns, relating to the geographic structure of the
asc map.
Many thanks for your advice
Roy
Roy Sanderson, Institute for Research on Environment and Sustainability (IRES), Devonshire Building, Newcastle University, Newcastle upon Tyne NE1 7RU r.a.sanderson at newcastle.ac.uk 0191 246 4835