I want to execute a 100x loop, get rownames from a dataframe A
and add its rownames
as values in a column to a new dataframe B
each time, ending with 100 columns in B
. I am beating my head against the wall here trying to do this, as I seem to overwrite B every way I have tried it.
data <- bs.exp.sorted.1198.input
outsft = dataframe
outsamps = dataframe
samples<- data.frame(matrix(0, nrow = 60, ncol = 1))
currentsamps =dataframe
itnumb=100
for(i in 1:itnumb){
subsamp <- data[sample(nrow(data), 60), ]
powers =c(c(1:10), seq(from=12,to=20,by=2))
sft =pickSoftThreshold(bs.exp.sorted.1198.input, powerVector = powers, verbose=5)
outsft <- rbind(outsft, sft$fitIndices[,2])
currentsamps <- as.data.frame(rownames(subsamp))
output <- add_column(samples, currentsamps)
}
output always contains a column of 0s (which I had to include to get it to work... And whatever the last set of rownames were in the loop. I want to save ALL the rownames in one big dataframe. This should be a simple task, but it has me stumped, and at this point, infuriated. Any suggestions? Thanks.