Skip to content
View ashenkin's full-sized avatar

Highlights

  • Pro

Organizations

@OxfordEcosystemsLab @Zanne-Lab

Block or report ashenkin

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse

Pinned Loading

  1. treestruct treestruct Public

    R package for analysis and manipulation of tree structure models

    R 6 3

  2. allieUtils allieUtils Public

    R package of my commonly used functions

    R 1

  3. Deviation (sum to zero) contrasts ar... Deviation (sum to zero) contrasts are important to use in models when one is interested in grand mean parameters and per-level deviations from that mean. However, the usual method of coding these contrasts in R ends up throwing away the associated variable names. As long as you understand what deviation contrasts do, there is no danger in maintaining these names (some assert this is dangerous, but I really don't think it is). The code below sets deviation contrasts, and maintains the names of the factor levels.
    1
    contr.sum.keepnames <- function(...) {
    2
        # make deviation contrasts that don't lose the names of the factors in the model results
    3
        # from https://stackoverflow.com/questions/10808853/why-does-changing-contrast-type-change-row-labels-in-r-lm-summary
    4
        conS <- contr.sum(...)
    5
        colnames(conS) = rownames(conS)[-length(rownames(conS))]
  4. How to predict results from lme4's g... How to predict results from lme4's glmer when fit with scaled data
    1
    # We often fit LMM/GLMM's with scaled variables.  However, making predictions using those models isn't straightforward (at least to me!)
    2
    # It turns out that you have to re-scale your prediction data using the same parameters used to scale your original data frame used to fit the model
    3
    # See below, and pay special attention to the section where the new data are rescaled.
    4
    
                  
    5
    library(lme4)
  5. Efficiently get higher taxon names (... Efficiently get higher taxon names (family, order, and subdivision) when you know genus or family. Merges NCBI and ITIS database returns.
    1
    query_higher_taxa_classes <- function(species_list, known = "genus", order = c("dataframe", "unique_sp")) {
    2
        # Pass in a character vector of species, genera, families, or whatever (the search is flexible)
    3
        # Returns a dataframe with the columns: query, db, family, order, subdivision
    4
        # The dataframe returned is guaranteed to be in the same order as the species list passed in if order is "dataframe"
    5
        order = match.arg(order)
  6. You have a digital elevation model (... You have a digital elevation model (DEM), and you want to make an elevation profile between two or more points. You want that elevation profile to reflect an average elevation across a swath, and not just a single point from a line. Here's one way to do it in R. Thanks to Forrest Stevens and other folks from the R-sig-geo list.
    1
    # Thanks to Forrest Stevens.  Some of the code here borrowed from him here: https://github.com/ForrestStevens/Scratch/blob/master/swath_slices.R
    2
    
                  
    3
    library(raster)
    4
    library(rgdal)
    5
    library(sp)