I have a dataset like this:
data <- data.frame(Time = c(1,4,6,9,11,13,16, 25, 32, 65),
A = c(10, NA, 13, 2, 32, 19, 32, 34, 93, 12),
B = c(1, 99, 32, 31, 12, 13, NA, 13, NA, NA),
C = c(2, 32, NA, NA, NA, NA, NA, NA, NA, NA))
What I want to retrieve are the values in Time
that corresponds to the last numerical value in A
, B
, and C
.
For example, the last numerical values for A
, B
, and C
are 12, 13, and 32 respectively.
So, the Time
values that correspond are 65, 25, and 4.
I've tried something like data[which(data$Time== max(data$A)), ]
, but this doesn't work.