Skip to content
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

add ready examples to docstring for rselect, rtransform (#321) #322

Merged
merged 4 commits into from
Mar 17, 2022

Conversation

mahiki
Copy link
Contributor

@mahiki mahiki commented Jan 19, 2022

I added REPL jldoctest examples for the @rselect and @rtransform macros to demonstrate the easy syntax for operations that need a ByRow treatment.

I choose these examples to show an easy way to post a value to a new column based on the row value in another column or combination of columns.

@mahiki
Copy link
Contributor Author

mahiki commented Jan 19, 2022

There was a doctest failure in my macro examples for @rtransform, and also @rselect. I'm not sure how this works so not able to determine what is missing.

The dataframe operations are correct in project REPL, I must be missing some syntax in the docsstring?

@bkamins
Copy link
Member

bkamins commented Jan 19, 2022

Probably julia> using DataFramesMeta; is needed (normally it should be set up to be globally loaded for all doctest strings, but I do not know if @pdeffebach did this)

@mahiki
Copy link
Contributor Author

mahiki commented Jan 19, 2022

Now I see. The other jldoctest sections are like this:

```jldoctest
julia> using DataFramesMeta      # <--- I didnt do this

julia> df = DataFrame(A = 1:3, B = [2, 1, 2]);

julia> @transform df begin
           :a = 2 * :A
           :x = :A .+ :B
# ..etc

@pdeffebach I will push another commit and try to update the PR or file a new one. Alternately, I could make @bkamins suggested change to make.jl:

I think @bkamins is saying that the following added to the make.jl file will alleviate the need to place `using DataFramesMeta for each doctest:

DocMeta.setdocmeta!(DataFramesMeta, :DocTestSetup, :(using DataFramesMeta); recursive=true)

Following the DataFrames.jl/doc/make.jl file.

@bkamins
Copy link
Member

bkamins commented Jan 19, 2022

@pdeffebach
Copy link
Collaborator

Yes we should definitely fix that. But just do the using DataFramesMeta line for now and we will simplify the docstrings in a later PR.

@pdeffebach
Copy link
Collaborator

Thanks a ton for this!

Do you think you could add these for @rorderby and @rsubset as well?

@mahiki
Copy link
Contributor Author

mahiki commented Jan 20, 2022

Do you think you could add these for @rorderby and @rsubset as well?

Very happy to. I'll commit those in the same branch, for this PR.

@mahiki
Copy link
Contributor Author

mahiki commented Feb 16, 2022

added minor change to df output.

@mahiki
Copy link
Contributor Author

mahiki commented Mar 9, 2022

Let me know if there are needed changes before running the workflow tests.

@pdeffebach
Copy link
Collaborator

Sorry about the delay on this! Will merge tomorrow

@pdeffebach pdeffebach merged commit 1945cb5 into JuliaData:master Mar 17, 2022
@pdeffebach
Copy link
Collaborator

Thanks! Sorry about the delay.

@mahiki
Copy link
Contributor Author

mahiki commented Mar 18, 2022

Awesome, ping me if you need some other help!

@mahiki mahiki deleted the issue-321_more-docstrings branch July 20, 2022 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants