Hi All,

If given a dataframe (long form) with Year, Species, and Location,
How would I write a function that would create a unique matrix of Species &
Location for each Year?

What I've tried doing is the following:

data #dataframe
dataT<-table(data$Species,data$Location,data$Year) #creates tables of
Species vs Location for each Year

But I'm encountering issues individually indexing the tables and converting
them into matrices in one fell swoop.

r1997<-as.matrix(tableT[,,"1997"]) #How I would do it individually; but I
can I make matrices for each year as a function?

Thanks in advance for your suggestions!

-- 
Lanna Jin

lannajin@gmail.com
510-898-8525

	[[alternative HTML version deleted]]

