#' @export
strip.last <- function(dat=hp6) {
## Must have run 'rbs' first!
orig.names <- c(paste0('T', c(1:5)), paste0('D', c(1:5)))
new.dat <- matrix(NA, nrow=nrow(dat), ncol=8)
pb <- txtProgressBar(title = "Reorganising remaining inflection point data", min = 0,
max = nrow(dat), style=3)
for(i in 1:nrow(dat)) {
setTxtProgressBar(pb, i, title=paste("Reorganising remaining inflection point data",
round(i/nrow(dat)*100, 0),
"% done"))
if(!is.na(dat$order[i])) {
last <- tail(unlist(strsplit(dat$order[i], '.', fixed=T)), 1)
keep.names <- setdiff(orig.names, paste0(c('T', 'D'), last))
new.dat[i,] <- as.numeric(dat[i,match(keep.names, names(dat))])
}
}
close(pb)
new.dat <- as.data.frame(new.dat)
names(new.dat) <- c(paste0('T', c(1:4)), paste0('D', c(1:4)))
new.dat
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.