R’s semantic riddles [🇷 for BE/BA]

posted by Helmut Homepage – Vienna, Austria, 2013-07-24 16:10 (4348 d 01:15 ago) – Posting: # 11047
Views: 9,181

Hi ElMaestro,

❝ age taking its toll on your eyes:-D? Go visit the veterinarian.


Sure. I’m a regular guest at my pet doctor. Where do you think I’m getting my pills from?

❝ -I had to read the online documentation to understand what which.max actually does.


Yeah, some of R’s functions are very efficient but difficult to comprehend. Martin once provided me with a framework full of lapply(), sweep(), aggregate(), simplify2array(), with(), etc. as a wrapper to functions used in sim’s. Speeded up the code at least 10fold. But: I read Cuneiform script more fluent than this gibberish.

In my code I use obscure one-liners only in sim’s where speed prevails over clarity.

❝ I wonder, how would Tmax be defined in cases of e.g.

time <- c( 0,  1,  1.5,  2,  4,  5,  6,  7,  8,  9)

conc <- c(NA, NA, 0.01, NA, 19, 56, 53, 46, 40, NA)


My code gives:
Tmax = 5
Tlag = 1
I’m happy with that. Or would you prefer to flag the 0.01 as crap and come up with a lagtime of 2? BTW, your code comes up with 1.5.

❝ - something like that is not entirely uncommon with OIPs, …


Not only with OIPs. We have discussed this issue occasionally (here and there).

❝ … some CROs are really spanking the 5500


Interesting hobby.

❝ … and manipulating the low QC integrations


They should not practice BDSM with their machines, but receive bastinado themselves. As a cap’tain you are familiar with the cat o’ nine tails. :pirate:


Edit: If time[1] is not given and no NAs occur before tmax, my code returns numeric(0), which cannot be used in further calculations.
  1. No lag-time, zero as NA:
    time <- c( 0, 1, 1.5, 2,  4,  5,  6,  7,  8,  9)
    conc <- c(NA, 1,   3, 5, 19, 56, 53, 46, 40, NA)
    data <- data.frame(time, conc)
    Tmax <- data$time[which(data$conc == max(data$conc[complete.cases(data)]))]
    Tlag <- data$time[which.max(complete.cases(data))-1] cat("Tmax =", Tmax, "\nTlag =", Tlag, "\n")
    Tmax = 5
    Tlag = 0

  2. No lag-time, zero time point not given:
    time <- c(1, 1.5, 2,  4,  5,  6,  7,  8,  9)
    conc <- c(1,   3, 5, 19, 56, 53, 46, 40, NA)
    data <- data.frame(time, conc)
    Tmax <- data$time[which(data$conc == max(data$conc[complete.cases(data)]))]
    Tlag <- data$time[which.max(complete.cases(data))-1] cat("Tmax =", Tmax, "\nTlag =", Tlag, "\n")
    Tmax = 5
    Tlag =

    Oops!
  3. As above + workaround:
    if(length(Tlag) == 0) Tlag <- 0
    cat("Tmax =", Tmax, "\nTlag =", Tlag, "\n")
    Tmax = 5
    Tlag = 0


Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes

Complete thread:

UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,677 registered users;
35 visitors (0 registered, 35 guests [including 10 identified bots]).
Forum time: 17:25 CEST (Europe/Vienna)

Philosophy, like medicine, has plenty of drugs, few good remedies,
and hardly any specific cures.    Sebastien-Roch Nicolas de Chamfort

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5