Displaying 2 results from an estimated 2 matches for "acmi2".
Did you mean:
acmin
2010 Mar 16
1
nested looping functions and dataframes
...hich(x$Year==i & x$Location==j),]
b<-as.data.frame(as.matrix(table(a$Species,a$Species)))
c<-b[-which(b$Var1==b$Var2),-3]
c$Year<-i; c$Location<-j
return(c)
}
Where, x is a dataframe that looks like the following:
> head(x,n=20)
Year Location Species
66 1998 PIPE_7 ACMI2
67 1998 PIPE_7 AMAR2
68 1998 PIPE_7 AMCA6
69 1998 PIPE_7 ANCY
70 1998 PIPE_7 ASVE
71 1998 PIPE_7 BOCU
72 1998 PIPE_7 CIFL
73 1998 PIPE_7 DAPU5
74 1998 PIPE_7 DICHANTHEL
75 1998 PIPE_7 GABO2
76 1998 PIPE_7 HEHE5
77 1998 PIPE_7...
2010 Mar 10
2
function to create multiple matrices
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