{"action":"created","comment":{"url":"https://api.github.com/repos/nlware/qdnatool/pulls/comments/66789042","id":66789042,"diff_hunk":"@@ -2,25 +2,67 @@\n library(psy)\n \n Analyse <- function(key, input.answers, number.answeroptions) {\n+  # Calculates standard psychometric properties of an exam, notably the\n+  # percentage correct and the item rest correlation (IRC) per item and\n+  # per answer option and the cronbach's alpha for the whole exam.\n+  #\n+  # Args:\n+  #   key: Matrix of 0's and 1's. key[i,j] implies wether answer option i\n+  #        to item j is right (1) or wrong (0). If a column (item) consists of\n+  #        only 0s, the item is interpreted as graded manually. This means\n+  #        that the same column of input.answers is used directly as a score\n+  #        (i.e. 1 is interpreted as a score of 1 instead of \"answer option\" 1).\n+  #        Number of columns (items) should be at least 3 and equal to the\n+  #        number of columns of input.answers and length of number.answeroptions.\n+  #        There is no maximum number of columns or rows\n+  #   input.answers: Ungraded matrix of answers. input.answers[i,j] is\n+  #                  the answer of student (i) to item (j). Should consist of\n+  #                  at least 3 columns (items) and 2 rows (students).\n+  #                  Number of columns should be at least 3 and equal to the\n+  #                  number of columns of key and length of number.answeroptions\n+  #                  There is no maximum.\n+  #   number.answersoptions: Vector with number of answer options per item.\n+  #                          Length should be at least 3 and equal to number of\n+  #                          columns of key and input.answers.\n+  #                          There is no maximum length.\n+  #\n+  # Returns:\n+  #  list with:\n+  #   Cronbach's alpha\n+  #   Maximum number of answer options\n+  #   Vector of number of correct per item\n+  #   Vector of percentage correct per item\n+  #   Vector of IRC per item\n+  #   Matrix[i,j] of number of students answering option i to item j\n+  #     (only if any multiple choice items are present, else returns a 0)\n+  #   Matrix[i,j] of percentage of students answering option i to item j\n+  #     (only if any multiple choice items are present, else returns a 0)\n+  #   Matrix[i,j] of IRC of answer option i to item j\n+  #     (only if any multiple choice items are present, else returns a 0)\n+\n   number.students <- nrow(input.answers)\n   number.questions <- ncol(input.answers)\n \n   if (number.questions > 2 & number.students > 1) {\n-    # Correct/Incorrect Matrix\n-    input.correct <- matrix(0, number.students, number.questions) \n+    # Do the analysis only if there are at least 3 items and 2 students.\n+\n+    # Create Correct/Incorrect matrix\n+    input.correct <- matrix(0, number.students, number.questions)\n \n     # Fill in Correct/Incorrect Matrix\n-    for (j in 1: number.questions) {\n-      for (i in 1: number.students) {\n+    for (j in 1 : number.questions) {\n+      for (i in 1 : number.students) {\n         if (!is.null(input.answers[i, j]) & all(key[, j] == 0)) {\n           input.correct[i, j] <- input.answers[i, j]\n-        } else if(any(input.answers[i, j] == which(key[, j] == 1))) {\n-          input.correct[i, j] <- 1\n+        } else {","path":"app/Lib/Rscripts/analyse.R","position":62,"original_position":62,"commit_id":"cdcb7ea2ac206abe6eb352de37a81790d9a1f21b","original_commit_id":"ff2eb4c8859fe2a12288c0ced4832163d9682404","user":{"login":"mvdriel","id":408052,"avatar_url":"https://avatars.githubusercontent.com/u/408052?v=3","gravatar_id":"","url":"https://api.github.com/users/mvdriel","html_url":"https://github.com/mvdriel","followers_url":"https://api.github.com/users/mvdriel/followers","following_url":"https://api.github.com/users/mvdriel/following{/other_user}","gists_url":"https://api.github.com/users/mvdriel/gists{/gist_id}","starred_url":"https://api.github.com/users/mvdriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvdriel/subscriptions","organizations_url":"https://api.github.com/users/mvdriel/orgs","repos_url":"https://api.github.com/users/mvdriel/repos","events_url":"https://api.github.com/users/mvdriel/events{/privacy}","received_events_url":"https://api.github.com/users/mvdriel/received_events","type":"User","site_admin":false},"body":"I don't think it is a problem to use the \"else if\" construction, because in that situation the else statement is still surrounded on the same line by curly braces.","created_at":"2016-06-13T13:16:07Z","updated_at":"2016-06-13T13:16:07Z","html_url":"https://github.com/nlware/qdnatool/pull/38#discussion_r66789042","pull_request_url":"https://api.github.com/repos/nlware/qdnatool/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/nlware/qdnatool/pulls/comments/66789042"},"html":{"href":"https://github.com/nlware/qdnatool/pull/38#discussion_r66789042"},"pull_request":{"href":"https://api.github.com/repos/nlware/qdnatool/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/nlware/qdnatool/pulls/38","id":53705292,"html_url":"https://github.com/nlware/qdnatool/pull/38","diff_url":"https://github.com/nlware/qdnatool/pull/38.diff","patch_url":"https://github.com/nlware/qdnatool/pull/38.patch","issue_url":"https://api.github.com/repos/nlware/qdnatool/issues/38","number":38,"state":"open","locked":false,"title":"WIP - Bug fix, description added, function is run","user":{"login":"SjoerdGlaser","id":12429891,"avatar_url":"https://avatars.githubusercontent.com/u/12429891?v=3","gravatar_id":"","url":"https://api.github.com/users/SjoerdGlaser","html_url":"https://github.com/SjoerdGlaser","followers_url":"https://api.github.com/users/SjoerdGlaser/followers","following_url":"https://api.github.com/users/SjoerdGlaser/following{/other_user}","gists_url":"https://api.github.com/users/SjoerdGlaser/gists{/gist_id}","starred_url":"https://api.github.com/users/SjoerdGlaser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SjoerdGlaser/subscriptions","organizations_url":"https://api.github.com/users/SjoerdGlaser/orgs","repos_url":"https://api.github.com/users/SjoerdGlaser/repos","events_url":"https://api.github.com/users/SjoerdGlaser/events{/privacy}","received_events_url":"https://api.github.com/users/SjoerdGlaser/received_events","type":"User","site_admin":false},"body":"Three changes have been made:\r\n\r\nA bug is fixed because the analyses could not be performed with 2 items. Now it only runs when at least three items are present.\r\n\r\nA description of the function has been added.\r\n\r\nA call to run the function has been added.\r\n\r\nFuthermore, files of the new project have been removed, so it only contains an update of the old analysis script.","created_at":"2015-12-15T13:52:06Z","updated_at":"2016-06-13T13:16:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d7922447c9449db24e7e04f4280f7a7b2a23563","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nlware/qdnatool/pulls/38/commits","review_comments_url":"https://api.github.com/repos/nlware/qdnatool/pulls/38/comments","review_comment_url":"https://api.github.com/repos/nlware/qdnatool/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nlware/qdnatool/issues/38/comments","statuses_url":"https://api.github.com/repos/nlware/qdnatool/statuses/cdcb7ea2ac206abe6eb352de37a81790d9a1f21b","head":{"label":"SjoerdGlaser:master","ref":"master","sha":"cdcb7ea2ac206abe6eb352de37a81790d9a1f21b","user":{"login":"SjoerdGlaser","id":12429891,"avatar_url":"https://avatars.githubusercontent.com/u/12429891?v=3","gravatar_id":"","url":"https://api.github.com/users/SjoerdGlaser","html_url":"https://github.com/SjoerdGlaser","followers_url":"https://api.github.com/users/SjoerdGlaser/followers","following_url":"https://api.github.com/users/SjoerdGlaser/following{/other_user}","gists_url":"https://api.github.com/users/SjoerdGlaser/gists{/gist_id}","starred_url":"https://api.github.com/users/SjoerdGlaser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SjoerdGlaser/subscriptions","organizations_url":"https://api.github.com/users/SjoerdGlaser/orgs","repos_url":"https://api.github.com/users/SjoerdGlaser/repos","events_url":"https://api.github.com/users/SjoerdGlaser/events{/privacy}","received_events_url":"https://api.github.com/users/SjoerdGlaser/received_events","type":"User","site_admin":false},"repo":{"id":36495266,"name":"qdnatool","full_name":"SjoerdGlaser/qdnatool","owner":{"login":"SjoerdGlaser","id":12429891,"avatar_url":"https://avatars.githubusercontent.com/u/12429891?v=3","gravatar_id":"","url":"https://api.github.com/users/SjoerdGlaser","html_url":"https://github.com/SjoerdGlaser","followers_url":"https://api.github.com/users/SjoerdGlaser/followers","following_url":"https://api.github.com/users/SjoerdGlaser/following{/other_user}","gists_url":"https://api.github.com/users/SjoerdGlaser/gists{/gist_id}","starred_url":"https://api.github.com/users/SjoerdGlaser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SjoerdGlaser/subscriptions","organizations_url":"https://api.github.com/users/SjoerdGlaser/orgs","repos_url":"https://api.github.com/users/SjoerdGlaser/repos","events_url":"https://api.github.com/users/SjoerdGlaser/events{/privacy}","received_events_url":"https://api.github.com/users/SjoerdGlaser/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SjoerdGlaser/qdnatool","description":"qdnatool","fork":true,"url":"https://api.github.com/repos/SjoerdGlaser/qdnatool","forks_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/forks","keys_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/teams","hooks_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/hooks","issue_events_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/issues/events{/number}","events_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/events","assignees_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/assignees{/user}","branches_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/branches{/branch}","tags_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/tags","blobs_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/git/refs{/sha}","trees_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/statuses/{sha}","languages_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/languages","stargazers_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/stargazers","contributors_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/contributors","subscribers_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/subscribers","subscription_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/subscription","commits_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/commits{/sha}","git_commits_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/git/commits{/sha}","comments_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/comments{/number}","issue_comment_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/issues/comments{/number}","contents_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/contents/{+path}","compare_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/merges","archive_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/downloads","issues_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/issues{/number}","pulls_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/pulls{/number}","milestones_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/milestones{/number}","notifications_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/labels{/name}","releases_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/releases{/id}","deployments_url":"https://api.github.com/repos/SjoerdGlaser/qdnatool/deployments","created_at":"2015-05-29T09:41:26Z","updated_at":"2016-02-12T12:39:31Z","pushed_at":"2016-06-13T11:25:37Z","git_url":"git://github.com/SjoerdGlaser/qdnatool.git","ssh_url":"git@github.com:SjoerdGlaser/qdnatool.git","clone_url":"https://github.com/SjoerdGlaser/qdnatool.git","svn_url":"https://github.com/SjoerdGlaser/qdnatool","homepage":null,"size":18072,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nlware:master","ref":"master","sha":"b6b69e524ec46c916e5f3791447b594190328db7","user":{"login":"nlware","id":2925338,"avatar_url":"https://avatars.githubusercontent.com/u/2925338?v=3","gravatar_id":"","url":"https://api.github.com/users/nlware","html_url":"https://github.com/nlware","followers_url":"https://api.github.com/users/nlware/followers","following_url":"https://api.github.com/users/nlware/following{/other_user}","gists_url":"https://api.github.com/users/nlware/gists{/gist_id}","starred_url":"https://api.github.com/users/nlware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlware/subscriptions","organizations_url":"https://api.github.com/users/nlware/orgs","repos_url":"https://api.github.com/users/nlware/repos","events_url":"https://api.github.com/users/nlware/events{/privacy}","received_events_url":"https://api.github.com/users/nlware/received_events","type":"Organization","site_admin":false},"repo":{"id":10028866,"name":"qdnatool","full_name":"nlware/qdnatool","owner":{"login":"nlware","id":2925338,"avatar_url":"https://avatars.githubusercontent.com/u/2925338?v=3","gravatar_id":"","url":"https://api.github.com/users/nlware","html_url":"https://github.com/nlware","followers_url":"https://api.github.com/users/nlware/followers","following_url":"https://api.github.com/users/nlware/following{/other_user}","gists_url":"https://api.github.com/users/nlware/gists{/gist_id}","starred_url":"https://api.github.com/users/nlware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlware/subscriptions","organizations_url":"https://api.github.com/users/nlware/orgs","repos_url":"https://api.github.com/users/nlware/repos","events_url":"https://api.github.com/users/nlware/events{/privacy}","received_events_url":"https://api.github.com/users/nlware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nlware/qdnatool","description":"qdnatool","fork":false,"url":"https://api.github.com/repos/nlware/qdnatool","forks_url":"https://api.github.com/repos/nlware/qdnatool/forks","keys_url":"https://api.github.com/repos/nlware/qdnatool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nlware/qdnatool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nlware/qdnatool/teams","hooks_url":"https://api.github.com/repos/nlware/qdnatool/hooks","issue_events_url":"https://api.github.com/repos/nlware/qdnatool/issues/events{/number}","events_url":"https://api.github.com/repos/nlware/qdnatool/events","assignees_url":"https://api.github.com/repos/nlware/qdnatool/assignees{/user}","branches_url":"https://api.github.com/repos/nlware/qdnatool/branches{/branch}","tags_url":"https://api.github.com/repos/nlware/qdnatool/tags","blobs_url":"https://api.github.com/repos/nlware/qdnatool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nlware/qdnatool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nlware/qdnatool/git/refs{/sha}","trees_url":"https://api.github.com/repos/nlware/qdnatool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nlware/qdnatool/statuses/{sha}","languages_url":"https://api.github.com/repos/nlware/qdnatool/languages","stargazers_url":"https://api.github.com/repos/nlware/qdnatool/stargazers","contributors_url":"https://api.github.com/repos/nlware/qdnatool/contributors","subscribers_url":"https://api.github.com/repos/nlware/qdnatool/subscribers","subscription_url":"https://api.github.com/repos/nlware/qdnatool/subscription","commits_url":"https://api.github.com/repos/nlware/qdnatool/commits{/sha}","git_commits_url":"https://api.github.com/repos/nlware/qdnatool/git/commits{/sha}","comments_url":"https://api.github.com/repos/nlware/qdnatool/comments{/number}","issue_comment_url":"https://api.github.com/repos/nlware/qdnatool/issues/comments{/number}","contents_url":"https://api.github.com/repos/nlware/qdnatool/contents/{+path}","compare_url":"https://api.github.com/repos/nlware/qdnatool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nlware/qdnatool/merges","archive_url":"https://api.github.com/repos/nlware/qdnatool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nlware/qdnatool/downloads","issues_url":"https://api.github.com/repos/nlware/qdnatool/issues{/number}","pulls_url":"https://api.github.com/repos/nlware/qdnatool/pulls{/number}","milestones_url":"https://api.github.com/repos/nlware/qdnatool/milestones{/number}","notifications_url":"https://api.github.com/repos/nlware/qdnatool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nlware/qdnatool/labels{/name}","releases_url":"https://api.github.com/repos/nlware/qdnatool/releases{/id}","deployments_url":"https://api.github.com/repos/nlware/qdnatool/deployments","created_at":"2013-05-13T09:54:39Z","updated_at":"2016-01-14T13:26:45Z","pushed_at":"2016-06-13T11:25:37Z","git_url":"git://github.com/nlware/qdnatool.git","ssh_url":"git@github.com:nlware/qdnatool.git","clone_url":"https://github.com/nlware/qdnatool.git","svn_url":"https://github.com/nlware/qdnatool","homepage":null,"size":18161,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":5,"forks":5,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nlware/qdnatool/pulls/38"},"html":{"href":"https://github.com/nlware/qdnatool/pull/38"},"issue":{"href":"https://api.github.com/repos/nlware/qdnatool/issues/38"},"comments":{"href":"https://api.github.com/repos/nlware/qdnatool/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/nlware/qdnatool/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/nlware/qdnatool/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nlware/qdnatool/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/nlware/qdnatool/statuses/cdcb7ea2ac206abe6eb352de37a81790d9a1f21b"}}}}
{"actor":{"display_login":"mvdriel"}}