search for: pr_mean

Displaying 1 result from an estimated 1 matches for "pr_mean".

2008 Jul 08
6
Question: Beginner stuck in a R cycle
Dear All, I have a database of 200 observations named myD. In the dataframe there are a column named code (with codes varying from 1 to 77), a column named "prevalence" with some quantitative measurements are given and an column named Pr_mean, with no values. I would like to set a cycle to compute the average of prevalence values for each different code and store the averages under the empty field Pr_mean. This is what I wrote: # Set a cycle for (i in 1:nrow(myD)) { mycode = myD$code[i] mymean[i] = mean(prevalence) myD$Pr_mean[i] = m...