R/getAlphanumeric.R

Defines functions getAlphaNumeric

Documented in getAlphaNumeric

## Functions for dealing with alphanumeric identifiers for larger well plates
## There may be one or two letters in the string
getAlphaNumeric = function(horizontal, vertical) {
    if (any(horizontal>702)) stop(sprintf("Indices of 'horizontal' well must not exceed %d", 26*27))
    if (any(vertical>99)) stop(sprintf("Indices of 'horizontal' well must not exceed %d.", 99))
    
    alpha1 <- c("", LETTERS) [(horizontal - 1)%/%length(LETTERS) + 1]
    alpha2 <- LETTERS[(horizontal-1) %% length(LETTERS) +1]
    id.num <- sprintf('%02d', vertical)
    id.alpha <- paste(alpha1, alpha2, sep='')
    id <- paste(id.alpha, id.num, sep='')
    return(list(id=id, id.alpha=id.alpha, id.num=id.num))
}

Try the prada package in your browser

Any scripts or data that you put into this service are public.

prada documentation built on April 28, 2020, 7:52 p.m.