{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/16443","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/16443/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/16443/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/16443/events","html_url":"https://github.com/JuliaLang/julia/issues/16443","id":155683093,"number":16443,"title":"Interest for repeat(x, lengths) function?","user":{"login":"nalimilan","id":1120448,"avatar_url":"https://avatars.githubusercontent.com/u/1120448?v=3","gravatar_id":"","url":"https://api.github.com/users/nalimilan","html_url":"https://github.com/nalimilan","followers_url":"https://api.github.com/users/nalimilan/followers","following_url":"https://api.github.com/users/nalimilan/following{/other_user}","gists_url":"https://api.github.com/users/nalimilan/gists{/gist_id}","starred_url":"https://api.github.com/users/nalimilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nalimilan/subscriptions","organizations_url":"https://api.github.com/users/nalimilan/orgs","repos_url":"https://api.github.com/users/nalimilan/repos","events_url":"https://api.github.com/users/nalimilan/events{/privacy}","received_events_url":"https://api.github.com/users/nalimilan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-05-19T08:44:04Z","updated_at":"2016-10-06T09:06:34Z","closed_at":null,"body":"DataArrays.jl currently offers a `rep` function modelled after R's, and which is mostly redundant with `repeat` (at least after  #14082  is merged). So I'd like to deprecate it.\r\n\r\nThere's one missing feature, though: `rep(x::AbstractVector, lenghts::AbstractVector)` returns a vector with each element repeated `lengths[i]` times. This is used once in DataFrames.jl, so it looks like it might be of more general use. Should we include this functionality in Base?\r\n\r\nIf yes, I'm not sure where it should go. It would be logical to add it to `repeat` via another keyword argument, but it would completely conflict with the existing ones, which means it would essentially be a separate function. We could add `repvec` to parallel `repmat` and support it there (with the same signature as `rep`). OTOH, it could be nice to be able to deprecate `repmat` when type inference is fixed for `repeat`.\r\n\r\nFor reference, the definition of `rep`:\r\n```julia\r\nfunction rep{T <: Integer}(x::AbstractVector, lengths::AbstractVector{T})\r\n    if length(x) != length(lengths)\r\n        throw(DimensionMismatch(\"vector lengths must match\"))\r\n    end\r\n    res = similar(x, sum(lengths))\r\n    i = 1\r\n    for idx in 1:length(x)\r\n        tmp = x[idx]\r\n        for kdx in 1:lengths[idx]\r\n            res[i] = tmp\r\n            i += 1\r\n        end\r\n    end\r\n    return res\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/251907028","html_url":"https://github.com/JuliaLang/julia/issues/16443#issuecomment-251907028","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/16443","id":251907028,"user":{"login":"nalimilan","id":1120448,"avatar_url":"https://avatars.githubusercontent.com/u/1120448?v=3","gravatar_id":"","url":"https://api.github.com/users/nalimilan","html_url":"https://github.com/nalimilan","followers_url":"https://api.github.com/users/nalimilan/followers","following_url":"https://api.github.com/users/nalimilan/following{/other_user}","gists_url":"https://api.github.com/users/nalimilan/gists{/gist_id}","starred_url":"https://api.github.com/users/nalimilan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nalimilan/subscriptions","organizations_url":"https://api.github.com/users/nalimilan/orgs","repos_url":"https://api.github.com/users/nalimilan/repos","events_url":"https://api.github.com/users/nalimilan/events{/privacy}","received_events_url":"https://api.github.com/users/nalimilan/received_events","type":"User","site_admin":false},"created_at":"2016-10-06T09:06:34Z","updated_at":"2016-10-06T09:06:34Z","body":"Should I interpret the small number of reactions as a sign of lack of support? :-)"}}
{"actor":{"display_login":"nalimilan"}}