{"action":"created","issue":{"url":"https://api.github.com/repos/mjockers/syuzhet/issues/9","labels_url":"https://api.github.com/repos/mjockers/syuzhet/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/mjockers/syuzhet/issues/9/comments","events_url":"https://api.github.com/repos/mjockers/syuzhet/issues/9/events","html_url":"https://github.com/mjockers/syuzhet/issues/9","id":65953010,"number":9,"title":"get_percentage_values occasionally returns 101 results","user":{"login":"bmschmidt","id":1110758,"avatar_url":"https://avatars.githubusercontent.com/u/1110758?v=3","gravatar_id":"","url":"https://api.github.com/users/bmschmidt","html_url":"https://github.com/bmschmidt","followers_url":"https://api.github.com/users/bmschmidt/followers","following_url":"https://api.github.com/users/bmschmidt/following{/other_user}","gists_url":"https://api.github.com/users/bmschmidt/gists{/gist_id}","starred_url":"https://api.github.com/users/bmschmidt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmschmidt/subscriptions","organizations_url":"https://api.github.com/users/bmschmidt/orgs","repos_url":"https://api.github.com/users/bmschmidt/repos","events_url":"https://api.github.com/users/bmschmidt/events{/privacy}","received_events_url":"https://api.github.com/users/bmschmidt/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-02T15:34:25Z","updated_at":"2015-04-18T23:08:49Z","closed_at":"2015-04-18T23:08:49Z","body":"On my architecture (Macbook air OS X 10.9, full system profile on request), the function get_percentage_values occasionally returns 101 results instead of 100: at lengths 201, 203, 205, etc. This makes it hard to directly compare results.\r\n\r\nThe distribution is actually regular in kind of a pretty way if you plot it: groups of 4,3,2,1 progressively farther apart as n gets higher. Maybe a floating point issue of some sort? It seems that 100.00000 is occasionally rounding up to 101.\r\n\r\nIn any case, using `cut` instead of `seq_along` and `ceiling` fixes it--I'm posting a patch.\r\n\r\n``` {r}\r\nlibrary(syuzhet)\r\nlengths = sapply(200:1500,function(n) {\r\n  dummy_sentiment_vector = sample(c(-1,0,1),n,replace=T) \r\n  length(get_percentage_values(dummy_sentiment_vector))\r\n})\r\nplot(200:1500,lengths)\r\n```\r\n\r\n\r\n![image](https://cloud.githubusercontent.com/assets/1110758/6967116/5c2cb0e0-d92b-11e4-867a-4f5fb1722100.png)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mjockers/syuzhet/issues/comments/94211449","html_url":"https://github.com/mjockers/syuzhet/issues/9#issuecomment-94211449","issue_url":"https://api.github.com/repos/mjockers/syuzhet/issues/9","id":94211449,"user":{"login":"mjockers","id":3277598,"avatar_url":"https://avatars.githubusercontent.com/u/3277598?v=3","gravatar_id":"","url":"https://api.github.com/users/mjockers","html_url":"https://github.com/mjockers","followers_url":"https://api.github.com/users/mjockers/followers","following_url":"https://api.github.com/users/mjockers/following{/other_user}","gists_url":"https://api.github.com/users/mjockers/gists{/gist_id}","starred_url":"https://api.github.com/users/mjockers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjockers/subscriptions","organizations_url":"https://api.github.com/users/mjockers/orgs","repos_url":"https://api.github.com/users/mjockers/repos","events_url":"https://api.github.com/users/mjockers/events{/privacy}","received_events_url":"https://api.github.com/users/mjockers/received_events","type":"User","site_admin":false},"created_at":"2015-04-18T23:08:49Z","updated_at":"2015-04-18T23:08:49Z","body":"Good fix Ben.  Was not even aware of the \"cut\" function."}}