R/select_bootstrap_data.R

select_bootstrap_data <-
function(datX, datY) {
		tdY <- table(datY)
		a <- sample(which(datY==names(tdY)[1]), tdY[1], replace=TRUE)
		b <- sample(which(datY==names(tdY)[2]), tdY[2], replace=TRUE)
		dbstr <- datX[c(a,b),]
		rownames(dbstr) <- paste(rownames(dbstr), 1:nrow(dbstr), sep=".")
		dYbstr <- datY[c(a,b)]
		stopifnot(all(dim(datX)==dim(dbstr)))
		list(datX=as.matrix(dbstr), datY=as.numeric(dYbstr))
	}

Try the bootfs package in your browser

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

bootfs documentation built on May 2, 2019, 5:50 p.m.