{"action":"created","issue":{"url":"https://api.github.com/repos/COSTDataExpo2013/MaurerOsthusLoy/issues/4","labels_url":"https://api.github.com/repos/COSTDataExpo2013/MaurerOsthusLoy/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/COSTDataExpo2013/MaurerOsthusLoy/issues/4/comments","events_url":"https://api.github.com/repos/COSTDataExpo2013/MaurerOsthusLoy/issues/4/events","html_url":"https://github.com/COSTDataExpo2013/MaurerOsthusLoy/issues/4","id":98842062,"number":4,"title":"Creating composite score data","user":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-03T21:31:03Z","updated_at":"2015-08-11T16:37:37Z","closed_at":null,"body":"I think this could be simplified quite a bit with a couple of functions like\r\n\r\n```R\r\nrescale01 <- function(x) {\r\n  rng <- range(x, na.rm = TRUE)\r\n  (x - rng[1]) / (rng[2] - rng[1])\r\n}\r\n\r\ncomposite_score <- function(x, wt) {\r\n   x <- rescale01(x)\r\n   x <- x[!is.na(x)]\r\n\r\n  mean(wt * x)\r\n}\r\n```\r\n\r\n(I think that's what you're doing, but I'm not absolutely sure)"},"comment":{"url":"https://api.github.com/repos/COSTDataExpo2013/MaurerOsthusLoy/issues/comments/129960556","html_url":"https://github.com/COSTDataExpo2013/MaurerOsthusLoy/issues/4#issuecomment-129960556","issue_url":"https://api.github.com/repos/COSTDataExpo2013/MaurerOsthusLoy/issues/4","id":129960556,"user":{"login":"aloy","id":1311926,"avatar_url":"https://avatars.githubusercontent.com/u/1311926?v=3","gravatar_id":"","url":"https://api.github.com/users/aloy","html_url":"https://github.com/aloy","followers_url":"https://api.github.com/users/aloy/followers","following_url":"https://api.github.com/users/aloy/following{/other_user}","gists_url":"https://api.github.com/users/aloy/gists{/gist_id}","starred_url":"https://api.github.com/users/aloy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aloy/subscriptions","organizations_url":"https://api.github.com/users/aloy/orgs","repos_url":"https://api.github.com/users/aloy/repos","events_url":"https://api.github.com/users/aloy/events{/privacy}","received_events_url":"https://api.github.com/users/aloy/received_events","type":"User","site_admin":false},"created_at":"2015-08-11T16:37:37Z","updated_at":"2015-08-11T16:37:37Z","body":"I pared down the code using your suggestion for rescale01 along with the weighted.mean function."}}