-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClipData #3
Comments
I like a lot of the ideas here; one of the things I wanted to add was something like what you've done with the table I/O (ie the header is recognizeable). One thought - because the argument or lack thereof disambiguates what the user is doing, I could see simplfiying the API: cliptable() # copies clipboard into Tables.jl compatible objects
cliptable(dataframe) # copies Tables.jl compartible object to clipboard
# without headers
cliparray() # copies clipboard into array
cliptable(arr) # copies arr to clipboard Alternatively (not sure if this syntax would work): clipdata() # copies clipboard into Tables.jl compatible objects
clipdatadataframe) # copies Tables.jl compartible object to clipboard
# without headers
clipdata(;header=false) # copies clipboard into array
clipdata(;asarray=true) # alternate of the above line
clipdata(arr) # copies arr to clipboard I haven't dug through, but I'm not sure what the meta-programming used in the example above does? Is it integral to what you are doing with the package or just demoing something? I'd be happy to work towards a combined package (maybe a name like |
Wonderful! I'm glad you want to work collaboratively on this. I like your idea w.r.t. dispatch, but I think it's non-trivial. Something can be both a Table and I'm probably partial to different functions for copying somthing to clipboard and taking something from the clipboard. They do sufficiently different things that having them have the same name seems a bit odd. The metaprogramming bit was so that the MWE in the code would have the same name as the object that's being created. w.r.t. making it agnostic about the output, we can take the same approach as
which would return a DataFrame. If empty it would return a |
Couple of questions/thoughts:
Feels a little backwards to me, normally I would expect to take the results of
The standard library function clipboard does use the same name for both directions: help?> clipboard
clipboard(x)
Send a printed form of x to the operating system clipboard ("copy").
──────────────────────────────────────────────────────────────────────────────────────
clipboard() -> AbstractString
Return a string with the contents of the operating system clipboard ("paste"). I think that one of the really nice things about some of the Julia data ecosystem is the consistency across Julia base. I guess if there's an imposible disambiguation given the more advanced feature set then it could make sense to have different names for the different directions. I haven't worked through the cases though, seems like you might have? |
Great. I think your points are all correct. I have started a new package, called ClipData which incorporates issues raised in this conversation into the API. The new API lives in ClipData.jl and has the following functions
That is to say, we follow the There is also no dependency on DataFrames. The user gets a However we require a dispatch on Does this API seem good to you? |
I think what you have makes sense. Looking at the code I see the What is |
Ah good call. About both the naming and the extra row at the bottom. I've made you a collaborator on ClipData.jl. If you have time, feel free to take a stab at either of those issues. The |
Update: I fixed the problem with the extra new line. All the functions are re-named. I also added tests. Now the next step is to add documentation. |
Great, thanks for making those updates! |
Hello! reposted from ActuaryUtilities here.
I really like the functions
xlcopy()
andxlcopy(data)
. I think it's really awesome to have such easy interoperability with excel.I'm glad this is in it's own package now, and I'm really sorry I missed that discourse thread announcing this package. That's my bad, I should have done my due diligence some more.
Yesterday I created ClipboardCSV which takes some of the core features from
xlcopy
and puts them in a standalone package. Here are some examples of how it worksLooking at this package, I think my implementation has a few features that would be really nice to merge into this one.
tabletoclip
is designed to work with Tables-compatible objects. Whilexlcopy
is designed to work with arrays.ClipboardCSV
provides thearraytoclip
for this feature. I think being explicit about the import source is good.PrettyTables
. I could imagine a user might want to copy and paste tables more easily, in particular a latex table. I am happy to drop this dependency if you think it isn't needed.One of the benefits of
xlcopy
only working with arrays is that you don't have to make a decision about the type of table as an output. ButCSV.File
is a perfectly fine table type that has all the features one needs. Though given that this is designed for interactive use, having DataFrames as a dependency might make sense so we can give people a more fully-featured table type that they are probably using anyways.Let me know your thoughts!
The same example from before, but now with tabs as delimiters for working with excel and with the new
arraytoclip
function.The text was updated successfully, but these errors were encountered: