{"action":"created","issue":{"url":"https://api.github.com/repos/CenterForAssessment/randomNames/issues/56","repository_url":"https://api.github.com/repos/CenterForAssessment/randomNames","labels_url":"https://api.github.com/repos/CenterForAssessment/randomNames/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/CenterForAssessment/randomNames/issues/56/comments","events_url":"https://api.github.com/repos/CenterForAssessment/randomNames/issues/56/events","html_url":"https://github.com/CenterForAssessment/randomNames/issues/56","id":352936414,"node_id":"MDU6SXNzdWUzNTI5MzY0MTQ=","number":56,"title":"Handle NAs in randomNames()'s gender argument","user":{"login":"msenn","id":15923027,"node_id":"MDQ6VXNlcjE1OTIzMDI3","avatar_url":"https://avatars1.githubusercontent.com/u/15923027?v=4","gravatar_id":"","url":"https://api.github.com/users/msenn","html_url":"https://github.com/msenn","followers_url":"https://api.github.com/users/msenn/followers","following_url":"https://api.github.com/users/msenn/following{/other_user}","gists_url":"https://api.github.com/users/msenn/gists{/gist_id}","starred_url":"https://api.github.com/users/msenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msenn/subscriptions","organizations_url":"https://api.github.com/users/msenn/orgs","repos_url":"https://api.github.com/users/msenn/repos","events_url":"https://api.github.com/users/msenn/events{/privacy}","received_events_url":"https://api.github.com/users/msenn/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-22T12:41:17Z","updated_at":"2018-08-30T11:33:42Z","closed_at":"2018-08-28T18:23:10Z","author_association":"NONE","body":"When calling `randomNames(gender = g)` on a gender vector that contains `NA`s, the generated names do no longer represent gender correctly:\r\n\r\n```\r\n# Define gender vector\r\n> (g <- rep(0:1, each = 3))\r\n[1] 0 0 0 1 1 1\r\n\r\n# Gender is correctly represented\r\n> randomNames::randomNames(gender = g, which.names = \"first\")\r\n[1] \"Samuel\"   \"Carlos\"   \"Theodore\" \"Emlynn\"   \"Briana\"   \"Deborah\" \r\n\r\n# Include NA in gender vector\r\n> g[3] <- NA\r\n> randomNames::randomNames(gender = g, which.names = \"first\")\r\n[1] \"Maleeha\" \"Sean\"    \"Sad\"     \"Sang\"    \"Labeeba\" \"Carter\" \r\n\r\n# First gender is 0 (male)\r\n> g[1]\r\n[1] 0\r\n\r\n# \"Maleeha\" is not among any mal first names list\r\n> fn_male <- grep(\"^first.*g0$\", names(randomNames::randomNamesData))\r\n> sapply(fn_male, function(i)  \"Maleeha\" %in% names(randomNames::randomNamesData[[\r\n+     names(randomNames::randomNamesData)[i]\r\n+     ]])\r\n+ )\r\n[1] FALSE FALSE FALSE FALSE FALSE FALSE\r\n```"},"comment":{"url":"https://api.github.com/repos/CenterForAssessment/randomNames/issues/comments/417287534","html_url":"https://github.com/CenterForAssessment/randomNames/issues/56#issuecomment-417287534","issue_url":"https://api.github.com/repos/CenterForAssessment/randomNames/issues/56","id":417287534,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzI4NzUzNA==","user":{"login":"msenn","id":15923027,"node_id":"MDQ6VXNlcjE1OTIzMDI3","avatar_url":"https://avatars1.githubusercontent.com/u/15923027?v=4","gravatar_id":"","url":"https://api.github.com/users/msenn","html_url":"https://github.com/msenn","followers_url":"https://api.github.com/users/msenn/followers","following_url":"https://api.github.com/users/msenn/following{/other_user}","gists_url":"https://api.github.com/users/msenn/gists{/gist_id}","starred_url":"https://api.github.com/users/msenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msenn/subscriptions","organizations_url":"https://api.github.com/users/msenn/orgs","repos_url":"https://api.github.com/users/msenn/repos","events_url":"https://api.github.com/users/msenn/events{/privacy}","received_events_url":"https://api.github.com/users/msenn/received_events","type":"User","site_admin":false},"created_at":"2018-08-30T11:33:42Z","updated_at":"2018-08-30T11:33:42Z","author_association":"NONE","body":"Thanks, Damian, for looking into this. As far as I can tell, the non-NA genders are now populated correctly.\r\n\r\nMay I ask what behavior you've chosen for the cases where gender is NA? I can think of multiple options that seem sensible:\r\n\r\n- Return NA in the name vector\r\n- Random draw a name from the names tables (without considering gender)\r\n- Random draw a gender from the non-missing elements of the gender vector\r\n\r\nPossibly, the information on the chosen behavior could be included in the documentation of the function."}}
{"actor":{"display_login":"msenn"}}