Skip to content

Commit

Permalink
fix leftjoin row order
Browse files Browse the repository at this point in the history
  • Loading branch information
mkborregaard committed Oct 17, 2021
1 parent 77c5aa6 commit a289afd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[compat]
DataFrames = "~1.0, ~1.1"
DataFrames = "1.0, 1.1, 1.2"
DataFramesMeta = "0.5, 0.6, 0.7, 0.8, 0.9"
Distances = "0.8, 0.9, 0.10"
EcoBase = "0.1"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/examples/nodebased.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ the [nodiv](https://github.com/mkborregaard/nodiv) R package
```@example nodebased
using ProgressLogging
function node_based_analysis(assemblage::Assemblage, tree::AbstractTree)
nodevec = collect(nodenamefilter(!isleaf, tree))
nodevec = traversal(tree, preorder) # collect(nodenamefilter(!isleaf, tree))
SOSs = Matrix{Float64}(undef, nsites(tyrants), length(nodevec))
GNDs = Vector{Float64}(undef, length(nodevec))
@progress for (i, node) in enumerate(nodevec)
println(i)
SOSs[:,i], GNDs[i] = process_node(tyrants, tree, node)
SOSs[:,i], GNDs[i] = process_node(tyrants, tree, getnodename(tree, node))
end
SOSs, GNDs
end
Expand Down
6 changes: 6 additions & 0 deletions src/GetandSetdata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ function addtraits!(asm::Assemblage, newtraits::DataFrames.DataFrame, species::S

nm = propertynames(newtraits)
rename!(newtraits, species => :name)
asm.occ.traits.__run_number = 1:nrow(asm.occ.traits)
asm.occ.traits = leftjoin(asm.occ.traits, newtraits, on = :name, makeunique = makeunique)
sort!(asm.occ.traits, :__run_number)
select!(asm.occ.traits, Not(:__run_number))
rename!(newtraits, nm)
#assemblagejoin!(asm.occ.traits, newtraits, :name, species)
nothing
Expand All @@ -94,7 +97,10 @@ function addsitestats!(asm::Assemblage, newsites::DataFrames.DataFrame, sites::S
#assemblagejoin!(asm.site.sitestats, newsites, :sites, sites) #TODO this should instead be on the sitenames of the objects and adjusted below
nm = propertynames(newsites)
rename!(newsites, sites => :sites)
asm.site.sitestats.__run_number = 1:nrow(asm.site.sitestats)
asm.site.sitestats = leftjoin(asm.site.sitestats, newsites, on = :sites, makeunique = makeunique)
sort!(asm.site.sitestats, :__run_number)
select!(asm.site.sitestats, Not(:__run_number))
rename!(newsites, nm)
nothing
end
Expand Down

2 comments on commit a289afd

@mkborregaard
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: "Tag with name v0.9.13 already exists and points to a different commit"

Please sign in to comment.