It seems that is not posible to send R file in the messages, well, then I
resend the message with the script included.
Hello, I'm creating a loop to work with vegan, to get a species abundance
curve. Here I send the script I've created and also an excel file to prove
what it can do.
Well, I have a database with 20 years, and each year we have sampled 19
stratum, and in each estratum we have carry out some sumpling. Then, with
the script that I've sent I've got to calculate the species abundance curve
for each stratum but only for one year. I want to be able to do this for the
20 years sampled but separately, obtaining one independent matrix for each
year, but I don't know how to do, I sure it's very simple but I've not
encountered the way to do it.
If someone can help me I would be very grateful, thank you
SCRIPT
library(reshape)
library(vegan)
Input="D:/R/Analisis aprendizaje/Input"
setwd(Input)
Data=read.table("PruebasRNA3.csv",header=T,sep=";",dec=".")
Estr=unique(Data$ESTRATO)
LEstr=length(Estr)
Results= matrix(nrow=20, ncol=LEstr)
Results[is.na(Results)]=0
for(i in 1:LEstr)
{
Datasel=Data[Data$ESTRATO==Estr[i],]
SubData=data.frame(Datasel$PESCA, Datasel$Sp, Datasel$Numero)
TransData <- reshape(SubData, v.names="Datasel.Numero",
idvar="Datasel.PESCA",
timevar="Datasel.Sp", direction="wide")TransData[is.na(TransData)] <- 0
{ Results[j,i]=SAC$richness[j] }
Alfonso Pérez Rodríguez
Instituto de Investigaciones Marinas
C/ Eduardo Cabello nº 6
C.P. 36208 Vigo (España)
Tlf.- 986231930 Extensión 241
e-mail: fonsilei_at_iim.csic.es
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Feb 2008 - 20:30:16 GMT.
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.