search for: mediandistance

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

2009 Jul 30
2
weight median by count for multiple records
...1002 2 1003 17 I have used the following script to calculate the median for a data frame where each recorded distance has its own row, and where temp is a dataframe containing each unique SubjectID and routes is the file I describe above. for(i in 1:nrow(temp)){ temp$mediandistance[i] <- median(routes$Distance_miles[routes$Subject_ID==temp$Subject_ID[i]]) } I am interested to know... (1) Is there a way to incorporate a weighted median into this script, where the weights are the number of times each distance is recorded? (2) Can I transform my current matrix into one that...