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

Aqpdf #142

Merged
merged 58 commits into from
Jun 19, 2020
Merged

Aqpdf #142

merged 58 commits into from
Jun 19, 2020

Conversation

brownag
Copy link
Member

@brownag brownag commented Jun 17, 2020

add support for data.table and tibble

brownag added 30 commits June 1, 2020 01:07
…rofileCollections (horizons, site, diagnostics, restrictions) #94
…th; in argillic application, this generally does not affect choice of illuvial horizon - but might have an effect in more aggregate data and or horizons with diffuse clay increases and/or thick transitional horizons
@dylanbeaudette
Copy link
Member

Thanks for the replies. These answer most of my questions. Lets have a short conversation next time you are in the office. I'm fine with merging as long as you are confident in the testing.

@brownag
Copy link
Member Author

brownag commented Jun 17, 2020

Please hold off on merging. I just wanted to make the pull request. It is much easier to track the progression of things in a PR. I suppose I will merge it when I am ready.

@dylanbeaudette
Copy link
Member

Yikes, if i could have not even shown you that commit but i committed it. I will revert it. I do think that I considered all of those things you just mentioned -- not saying they are implemented in that code.

Nothing to be ashamed of, that is some very elegant code in there. Lets talk some more about it because I am about to do a total re-write of profile_compare(). Note that profile_compare() can accommodate site-level attributes.

@brownag
Copy link
Member Author

brownag commented Jun 17, 2020 via email

@dylanbeaudette
Copy link
Member

The algorithm is sound, tested, applied to large collections, and applied to a diverse sets of data. That said, there are a lot of inefficiencies in the code and some style-related issues that make me want to go back and give 2009-me a whack.

Most of the problems / TODO / ideas are outlined in #7 and the comments within profile_compare.R, as you found. I'm thinking about setting more default arguments (max_d, k) so that the function is simpler to use.

I'd like to discuss (later this month?) your thoughts on the matter and the novelties in gower.R. I spent some time last night looking over the weighting used, but as you say there could be something that I missed. If the two algorithms are sufficiently different, then I'd suggest giving it a name and we have both in aqp. There is no single numerical classification approach that solves every problem, so it is nice to have a couple options.

One small suggestion: add profile IDs and return as a dist object so that you can hang the profiles from a dendrogram. Or, arrange the profile IDs according to an ordination for an evaluation of proximity. Ordering sketches based on rows of the distance matrix is far less informative that would otherwise seem.

Another option, try vegan::betadisper for an interesting take on ordination.
image

@@ -139,7 +140,7 @@ setMethod('reorderHorizons',
order(as.character(h[[idname(object)]]),
h[[horizonDepths(object)[1]]]))

h <- aqp:::.as.data.frame.aqp(h[current.order,],
h <- .as.data.frame.aqp(h[current.order,],
Copy link
Member

Choose a reason for hiding this comment

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

Is this going to be necessary for all functions that modify @horizons or slot previously containing a data.frame?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, if you want to be sure that you preserve the datatype the user set. It incurs no unnecessary overhead unless something occurred that changed the type.



# remove bad profiles and try again: works
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch. I'll review the current logic, wouldn't be surprised if it has missed something.

@@ -169,4 +169,6 @@ test_that("addVolumeFraction fractional horizon depths", {

})


# cleanup
if (file.exists("Rplots.pdf"))
Copy link
Member

Choose a reason for hiding this comment

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

Thanks.

@brownag
Copy link
Member Author

brownag commented Jun 19, 2020

Documentation (#139) is implemented for all of the fundamental internal S4 functions for the SPC class that manipulate slots etc. The R CMD check manual page problems have been fixed -- there were a couple mistakes I had made -- typos in names, missing things, duplications etc.

I will probably need to write a Wiki page to make it easier / remember all the details for the future and make sure everyone knows how to do it.

I will be moving on to others (plots, slice/slab, profile_compare, etc) in the near future now that I have ironed out the process. roxygen is very straightforward with ordinary functions but the S4 methods require a lot more care. With S4, I think some of the things I am be doing are redundant relative to most modern version of roxygen and its ability to "guess" the right values -- so with some more testing I can probably pare down the markup further.

EDIT: already informed of issue with pc

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.

2 participants