{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/802","labels_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/802/labels{/name}","comments_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/802/comments","events_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/802/events","html_url":"https://github.com/JuliaStats/DataFrames.jl/issues/802","id":77732044,"number":802,"title":"hcat inconsistency","user":{"login":"fiatflux","id":3394102,"avatar_url":"https://avatars.githubusercontent.com/u/3394102?v=3","gravatar_id":"","url":"https://api.github.com/users/fiatflux","html_url":"https://github.com/fiatflux","followers_url":"https://api.github.com/users/fiatflux/followers","following_url":"https://api.github.com/users/fiatflux/following{/other_user}","gists_url":"https://api.github.com/users/fiatflux/gists{/gist_id}","starred_url":"https://api.github.com/users/fiatflux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fiatflux/subscriptions","organizations_url":"https://api.github.com/users/fiatflux/orgs","repos_url":"https://api.github.com/users/fiatflux/repos","events_url":"https://api.github.com/users/fiatflux/events{/privacy}","received_events_url":"https://api.github.com/users/fiatflux/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-18T17:12:47Z","updated_at":"2015-05-22T14:07:38Z","closed_at":null,"body":"I would expect\r\n```\r\nhcat([DataFrame(a=[1,2,3])]...)\r\n```\r\nto be have like\r\n```\r\nhcat([DataFrame(a=[1,2,3]), DataFrame(b=[4,5,6])]...)\r\n```\r\nby returning a DataFrame but instead it yields an array.\r\n\r\nI recognize this looks like a strange example, but I have a situation wherein I need to hcat an arbitrary number of DataFrames and writing a special case for the situation of a single DataFrame seems ugly. (While we're at it, I reckon hcat() should return an empty DataFrame.)"},"comment":{"url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/comments/104668848","html_url":"https://github.com/JuliaStats/DataFrames.jl/issues/802#issuecomment-104668848","issue_url":"https://api.github.com/repos/JuliaStats/DataFrames.jl/issues/802","id":104668848,"user":{"login":"davidagold","id":11862683,"avatar_url":"https://avatars.githubusercontent.com/u/11862683?v=3","gravatar_id":"","url":"https://api.github.com/users/davidagold","html_url":"https://github.com/davidagold","followers_url":"https://api.github.com/users/davidagold/followers","following_url":"https://api.github.com/users/davidagold/following{/other_user}","gists_url":"https://api.github.com/users/davidagold/gists{/gist_id}","starred_url":"https://api.github.com/users/davidagold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidagold/subscriptions","organizations_url":"https://api.github.com/users/davidagold/orgs","repos_url":"https://api.github.com/users/davidagold/repos","events_url":"https://api.github.com/users/davidagold/events{/privacy}","received_events_url":"https://api.github.com/users/davidagold/received_events","type":"User","site_admin":false},"created_at":"2015-05-22T14:07:38Z","updated_at":"2015-05-22T14:07:38Z","body":"That's fair. However, I don't think that `hcat()` should return an empty DataFrame. The following seems to work\r\n```\r\njulia> hcat(df1::DataFrame, df2, dfs...)=hcat(hcat(df1, df2), dfs...)\r\nhcat (generic function with 21 methods)\r\n\r\njulia> df1 = DataFrame(a=1:5)\r\n5x1 DataFrame\r\n| Row | a |\r\n|-----|---|\r\n| 1   | 1 |\r\n| 2   | 2 |\r\n| 3   | 3 |\r\n| 4   | 4 |\r\n| 5   | 5 |\r\n\r\njulia> df2 = DataFrame(b=6:10)\r\n5x1 DataFrame\r\n| Row | b  |\r\n|-----|----|\r\n| 1   | 6  |\r\n| 2   | 7  |\r\n| 3   | 8  |\r\n| 4   | 9  |\r\n| 5   | 10 |\r\n\r\njulia> df3 = DataFrame(c=11:15)\r\n5x1 DataFrame\r\n| Row | c  |\r\n|-----|----|\r\n| 1   | 11 |\r\n| 2   | 12 |\r\n| 3   | 13 |\r\n| 4   | 14 |\r\n| 5   | 15 |\r\n\r\njulia> hcat(df1, df2, df3)\r\n5x3 DataFrame\r\n| Row | a | b  | c  |\r\n|-----|---|----|----|\r\n| 1   | 1 | 6  | 11 |\r\n| 2   | 2 | 7  | 12 |\r\n| 3   | 3 | 8  | 13 |\r\n| 4   | 4 | 9  | 14 |\r\n| 5   | 5 | 10 | 15 |\r\n```\r\nHowever, I have one large misgiving, namely that this implementation would potentially frustrate anybody who actually wants to create an array of DataFrame objects. Same goes for `vcat`. Maybe we should have something like `hjoin` and `vjoin` as the respective \"concatenation\" operators for DataFrame objects, though perhaps this usage is not entirely in keeping with a strict interpretation of \"join\"."}}