floweringSim <- function(ngids, nenvs,flo.mean, sd.flo,stages,max=NULL,min=NULL,gid=NULL,env=NULL){
hibrids <- data.frame(gid = gid,
flo.mean = flo.mean ,
sd.flo = sd.flo )
met_hibrids<-ddply(hibrids,.(gid),function(x) round(rnorm(n = nenvs,mean = x$flo.mean,sd = x$sd.flo),0))
if(is.null(env)){ env <- paste0('env',1:nenvs)}
names(met_hibrids)[-1] <- env
# florescimento de cada hibrido em cada ambiente
row.names(met_hibrids) <- met_hibrids$gid
met_hibrids <- as.matrix(met_hibrids[,-1])
GE <- data.frame(
matrix(1,nrow=ngids,ncol=nenvs) %x% matrix(stages) + met_hibrids %x% matrix(1,nrow=length(stages))
)
head(GE)
colnames(GE) <- paste0('env',1:nenvs)
if(is.null(gid)){gid<-paste0("gid",1:ngids)}
GE$gid <- rep(gid,each=length(stages))
GE <- melt(GE,variable.name = 'env',value.name = 'breaks')
if(is.null(max)){max <- 130}
if(is.null(min)){min <- 10}
GE$breaks[GE$breaks < min] <- -Inf
GE$breaks[GE$breaks > max] <- Inf
return(GE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.