Displaying 1 result from an estimated 1 matches for "sumdvm".
2011 Mar 22
1
help need on working in subset within a dataframe
...# just example there is long vector calculations in read dataset
kt1 <- K1 * K2
kt2 <- K1 / K2
Qni <- (K1*(kt1-0.25)+ K2 *(kt2-0.25))
y <- dataframe$y
yg <- mean(y, na.rm= TRUE) # mean of trait Y # mean of trait Y
dvm <- (y-yg ) # deviation of phenotypic value from mean
sumdvm <-abs(sum(dvm, na.rm= TRUE))
yQni <- y* Qni
sumyQni <-abs(sum(yQni, na.rm= TRUE))
npt = ( sumdvm/ sumyQni)
return(npt)
}
npt1 <- apply(namemat,1, smyfun)
return(npt1)
}
myfun (dataframe)
My question is how can I automate the process so that the above function can
calc...