{"action":"opened","issue":{"url":"https://api.github.com/repos/mikejacktzen/datzen/issues/1","repository_url":"https://api.github.com/repos/mikejacktzen/datzen","labels_url":"https://api.github.com/repos/mikejacktzen/datzen/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/mikejacktzen/datzen/issues/1/comments","events_url":"https://api.github.com/repos/mikejacktzen/datzen/issues/1/events","html_url":"https://github.com/mikejacktzen/datzen/issues/1","id":232726318,"number":1,"title":"enhance readss() function with ","user":{"login":"mikejacktzen","id":3439818,"avatar_url":"https://avatars2.githubusercontent.com/u/3439818?v=3","gravatar_id":"","url":"https://api.github.com/users/mikejacktzen","html_url":"https://github.com/mikejacktzen","followers_url":"https://api.github.com/users/mikejacktzen/followers","following_url":"https://api.github.com/users/mikejacktzen/following{/other_user}","gists_url":"https://api.github.com/users/mikejacktzen/gists{/gist_id}","starred_url":"https://api.github.com/users/mikejacktzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikejacktzen/subscriptions","organizations_url":"https://api.github.com/users/mikejacktzen/orgs","repos_url":"https://api.github.com/users/mikejacktzen/repos","events_url":"https://api.github.com/users/mikejacktzen/events{/privacy}","received_events_url":"https://api.github.com/users/mikejacktzen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-31T23:31:55Z","updated_at":"2017-05-31T23:31:55Z","closed_at":null,"body":"enhance readss() function with \r\n\r\nrle() + fread() solution in \r\nhttps://stackoverflow.com/questions/21798930/how-to-read-specific-rows-of-csv-file-with-fread-function\r\n\r\n```\r\n# create sample dataset\r\nset.seed(1)\r\nm   <- matrix(rnorm(1e5),ncol=10)\r\ncsv <- data.frame(x=1:1e4,m)\r\nwrite.csv(csv,\"test.csv\")\r\n# s: rows we want to read\r\ns <- c(1:50,53, 65,77,90,100:200,350:500, 5000:6000)\r\n# v: logical, T means read this row (equivalent to your read_vec)\r\nv <- (1:1e4 %in% s)\r\n\r\nseq  <- rle(v)\r\nidx  <- c(0, cumsum(seq$lengths))[which(seq$values)] + 1\r\n# indx: start = starting row of sequence, length = length of sequence (compare to s)\r\nindx <- data.frame(start=idx, length=seq$length[which(seq$values)])\r\n\r\nlibrary(data.table)\r\nresult <- do.call(rbind,apply(indx,1, function(x) return(fread(\"test.csv\",nrows=x[2],skip=x[1]))))\r\n```\r\nwill not have major clocktime speed gain, but does beancount temp memory"}}
{"actor":{"display_login":"mikejacktzen"}}